mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 12:50:09 +00:00
Backed out changeset f255030d86d8 (bug 1577122) for causing talos crashes in Bug 1762611.
This commit is contained in:
parent
e75208ec5b
commit
ae056f8313
@ -31,8 +31,12 @@ server.registerPathHandler("/", (request, response) => {
|
||||
response.write(HTML);
|
||||
});
|
||||
|
||||
function getResourceURI(file) {
|
||||
return Services.io.newFileURI(do_get_file(file)).spec;
|
||||
}
|
||||
|
||||
const { AllowJavascriptParent } = ChromeUtils.import(
|
||||
"resource://test/AllowJavascriptParent.jsm"
|
||||
getResourceURI("AllowJavascriptParent.jsm")
|
||||
);
|
||||
|
||||
async function assertScriptsAllowed(bc, expectAllowed, desc) {
|
||||
@ -65,11 +69,11 @@ add_task(async function() {
|
||||
ChromeUtils.registerWindowActor(ACTOR, {
|
||||
allFrames: true,
|
||||
child: {
|
||||
moduleURI: "resource://test/AllowJavascriptChild.jsm",
|
||||
moduleURI: getResourceURI("AllowJavascriptChild.jsm"),
|
||||
events: { load: { capture: true } },
|
||||
},
|
||||
parent: {
|
||||
moduleURI: "resource://test/AllowJavascriptParent.jsm",
|
||||
moduleURI: getResourceURI("AllowJavascriptParent.jsm"),
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -14,7 +14,7 @@ function* testSteps() {
|
||||
|
||||
// Test for IDBKeyRange and indexedDB availability in JS modules.
|
||||
const { GlobalObjectsModule } = ChromeUtils.import(
|
||||
"resource://test/GlobalObjectsModule.jsm"
|
||||
getSpec("GlobalObjectsModule.jsm")
|
||||
);
|
||||
let test = new GlobalObjectsModule();
|
||||
test.ok = ok;
|
||||
|
@ -1253,12 +1253,6 @@ nsresult mozJSComponentLoader::Import(JSContext* aCx,
|
||||
// Note: This implies EnsureURI().
|
||||
MOZ_TRY(info.EnsureResolvedURI());
|
||||
|
||||
// Reject imports from untrusted sources.
|
||||
if ((!info.URI()->SchemeIs("resource")) &&
|
||||
(!info.URI()->SchemeIs("chrome"))) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
// get the JAR if there is one
|
||||
nsCOMPtr<nsIJARURI> jarURI;
|
||||
jarURI = do_QueryInterface(info.ResolvedURI(), &rv);
|
||||
|
@ -3,8 +3,13 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
function run_test() {
|
||||
var file = do_get_file("syntax_error.jsm");
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService);
|
||||
var uri = ios.newFileURI(file);
|
||||
|
||||
try {
|
||||
ChromeUtils.import("resource://test/syntax_error.jsm");
|
||||
ChromeUtils.import(uri.spec);
|
||||
do_throw("Failed to report any error at all");
|
||||
} catch (e) {
|
||||
Assert.notEqual(/^SyntaxError:/.exec(e + ''), null);
|
||||
|
@ -49,10 +49,8 @@ function run_test() {
|
||||
dump("resURI: " + resURI + "\n");
|
||||
var filePath = res.resolveURI(resURI);
|
||||
var scope3 = {};
|
||||
Assert.throws(
|
||||
() => ChromeUtils.import(filePath, scope3),
|
||||
/SecurityError/, "Expecting file URI not to be imported"
|
||||
);
|
||||
Assert.throws(() => ChromeUtils.import(filePath, scope3),
|
||||
/NS_ERROR_UNEXPECTED/);
|
||||
|
||||
// make sure we throw when the second arg is bogus
|
||||
var didThrow = false;
|
||||
@ -90,12 +88,4 @@ function run_test() {
|
||||
.createInstance(Ci.nsIClassInfo);
|
||||
Assert.ok(Boolean(bar));
|
||||
Assert.ok(bar.contractID == contractID + "2");
|
||||
|
||||
// make sure we throw when the URL scheme is not known
|
||||
var scope4 = {};
|
||||
const wrongScheme = "data:text/javascript,var a = {a:1}";
|
||||
Assert.throws(
|
||||
() => ChromeUtils.import(wrongScheme, scope4),
|
||||
/SecurityError/, "Expecting data URI not to be imported"
|
||||
);
|
||||
}
|
||||
|
@ -12,15 +12,9 @@ async function runBackgroundTask(commandLine) {
|
||||
// sibling `testcrasher` library to be in the current working
|
||||
// directory. Fail right away if we can't find the module or the
|
||||
// native library.
|
||||
let cwd = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
|
||||
let protocolHandler = Services.io
|
||||
.getProtocolHandler("resource")
|
||||
.QueryInterface(Ci.nsIResProtocolHandler);
|
||||
var curDirURI = Services.io.newFileURI(cwd);
|
||||
protocolHandler.setSubstitution("test", curDirURI);
|
||||
|
||||
let testPath = Services.dirsvc.get("CurWorkD", Ci.nsIFile).path;
|
||||
const { CrashTestUtils } = ChromeUtils.import(
|
||||
"resource://test/CrashTestUtils.jsm"
|
||||
`file://${testPath}/CrashTestUtils.jsm`
|
||||
);
|
||||
|
||||
// Get the temp dir.
|
||||
|
@ -53,8 +53,6 @@ TESTING_JS_MODULES += [
|
||||
"ExtensionTestCommon.jsm",
|
||||
"ExtensionXPCShellUtils.jsm",
|
||||
"MessageChannel.jsm",
|
||||
"test/xpcshell/data/TestWorkerWatcherChild.jsm",
|
||||
"test/xpcshell/data/TestWorkerWatcherParent.jsm",
|
||||
]
|
||||
|
||||
DIRS += [
|
||||
|
@ -111,12 +111,15 @@ class TestWorkerWatcher extends ExtensionCommon.EventEmitter {
|
||||
|
||||
registerProcessActor() {
|
||||
const { JS_ACTOR_NAME } = this;
|
||||
const getModuleURI = fileName =>
|
||||
Services.io.newFileURI(do_get_file(`${this.dataRelPath}/${fileName}`))
|
||||
.spec;
|
||||
ChromeUtils.registerProcessActor(JS_ACTOR_NAME, {
|
||||
parent: {
|
||||
moduleURI: `resource://testing-common/${JS_ACTOR_NAME}Parent.jsm`,
|
||||
moduleURI: getModuleURI(`${JS_ACTOR_NAME}Parent.jsm`),
|
||||
},
|
||||
child: {
|
||||
moduleURI: `resource://testing-common/${JS_ACTOR_NAME}Child.jsm`,
|
||||
moduleURI: getModuleURI(`${JS_ACTOR_NAME}Child.jsm`),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user