diff options
Diffstat (limited to 'js/xpconnect/tests')
-rw-r--r-- | js/xpconnect/tests/chrome/test_xrayToJS.xul | 18 | ||||
-rw-r--r-- | js/xpconnect/tests/unit/test_exportFunction.js | 3 | ||||
-rw-r--r-- | js/xpconnect/tests/unit/test_xray_regexp.js | 9 | ||||
-rw-r--r-- | js/xpconnect/tests/unit/xpcshell.ini | 1 |
4 files changed, 19 insertions, 12 deletions
diff --git a/js/xpconnect/tests/chrome/test_xrayToJS.xul b/js/xpconnect/tests/chrome/test_xrayToJS.xul index 2f4e70f47..ed67a34fe 100644 --- a/js/xpconnect/tests/chrome/test_xrayToJS.xul +++ b/js/xpconnect/tests/chrome/test_xrayToJS.xul @@ -198,9 +198,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=933681 "pop", "shift", "unshift", "splice", "concat", "slice", "lastIndexOf", "indexOf", "includes", "forEach", "map", "reduce", "reduceRight", "filter", "some", "every", "find", "findIndex", "copyWithin", "fill", Symbol.iterator, Symbol.unscopables, "entries", "keys", - "constructor"]; + "values", "constructor"]; if (isNightlyBuild) { - gPrototypeProperties['Array'].push("values"); + // ...nothing now } gConstructorProperties['Array'] = constructorProps(["join", "reverse", "sort", "push", "pop", "shift", @@ -220,11 +220,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=933681 // There is no TypedArray constructor, looks like. is(window.TypedArray, undefined, "If this ever changes, add to this test!"); for (var c of errorObjectClasses) { - gPrototypeProperties[c] = ["constructor", "name", - // We don't actually resolve these empty data properties - // onto the Xray prototypes, but we list them here to make - // the test happy. - "lineNumber", "columnNumber", "fileName", "message", "stack"]; + gPrototypeProperties[c] = ["constructor", "name", "message", "stack"]; gConstructorProperties[c] = constructorProps([]); } // toString and toSource only live on the parent proto (Error.prototype). @@ -239,8 +235,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=933681 gPrototypeProperties['RegExp'] = ["constructor", "toSource", "toString", "compile", "exec", "test", Symbol.match, Symbol.replace, Symbol.search, Symbol.split, - "flags", "global", "ignoreCase", "multiline", "source", "sticky", "unicode", - "lastIndex"]; + "flags", "global", "ignoreCase", "multiline", "source", "sticky", "unicode"]; gConstructorProperties['RegExp'] = constructorProps(["input", "lastMatch", "lastParen", "leftContext", "rightContext", "$1", "$2", "$3", "$4", @@ -791,8 +786,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=933681 // We only invoke testXray with Error, because that function isn't set up // to deal with dependent classes and fixing it up is more trouble than // it's worth. - testXray('Error', new iwin.Error('some error message'), new iwin.Error(), - ['fileName', 'lineNumber', 'columnNumber', 'message']); + testXray('Error', new iwin.Error('some error message'), new iwin.Error()); // Make sure that the dependent classes have their prototypes set up correctly. for (let c of errorObjectClasses.filter(x => x != "Error")) { @@ -806,7 +800,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=933681 e.wrappedJSObject[name] = goodReplacement; is(e[name], goodReplacement, name + " property ok after replacement: " + goodReplacement); e.wrappedJSObject[name] = faultyReplacement; - is(e[name], undefined, name + " property censored after suspicious replacement"); + is(e[name], name == 'message' ? "" : undefined, name + " property skipped after suspicious replacement"); } testProperty('message', x => x == 'some message', 'some other message', 42); testProperty('fileName', x => x == '', 'otherFilename.html', new iwin.Object()); diff --git a/js/xpconnect/tests/unit/test_exportFunction.js b/js/xpconnect/tests/unit/test_exportFunction.js index 830816342..9e1bf2082 100644 --- a/js/xpconnect/tests/unit/test_exportFunction.js +++ b/js/xpconnect/tests/unit/test_exportFunction.js @@ -10,12 +10,14 @@ function run_test() { epsb.do_check_true = do_check_true; epsb.do_check_eq = do_check_eq; subsb.do_check_true = do_check_true; + subsb.do_check_eq = do_check_eq; // Exporting should work if prinicipal of the source sandbox // subsumes the principal of the target sandbox. Cu.evalInSandbox("(" + function() { var wasCalled = false; this.funToExport = function(expectedThis, a, obj, native, mixed, callback) { + do_check_eq(arguments.callee.length, 6); do_check_eq(a, 42); do_check_eq(obj, subsb.tobecloned); do_check_eq(obj.cloned, "cloned"); @@ -53,6 +55,7 @@ function run_test() { invokedCallback = false; callback = function() { invokedCallback = true; }; imported(this, 42, tobecloned, native, mixed, callback); + do_check_eq(imported.length, 6); do_check_true(invokedCallback); }.toSource() + ")()", subsb); diff --git a/js/xpconnect/tests/unit/test_xray_regexp.js b/js/xpconnect/tests/unit/test_xray_regexp.js new file mode 100644 index 000000000..4baffd63e --- /dev/null +++ b/js/xpconnect/tests/unit/test_xray_regexp.js @@ -0,0 +1,9 @@ +const Cu = Components.utils; + +function run_test() { + var sandbox = Cu.Sandbox('http://www.example.com'); + var regexp = Cu.evalInSandbox("/test/i", sandbox); + equal(RegExp.prototype.toString.call(regexp), "/test/i"); + var prototype = Cu.evalInSandbox("RegExp.prototype", sandbox); + equal(typeof prototype.lastIndex, "undefined"); +} diff --git a/js/xpconnect/tests/unit/xpcshell.ini b/js/xpconnect/tests/unit/xpcshell.ini index 99d44b975..12648d3ec 100644 --- a/js/xpconnect/tests/unit/xpcshell.ini +++ b/js/xpconnect/tests/unit/xpcshell.ini @@ -133,5 +133,6 @@ head = head_watchdog.js [test_xrayed_iterator.js] [test_xray_SavedFrame.js] [test_xray_SavedFrame-02.js] +[test_xray_regexp.js] [test_resolve_dead_promise.js] [test_asyncLoadSubScriptError.js] |