зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1003095 - Create a whitelist for the chrome module;r=past
This commit is contained in:
Родитель
19550e9c57
Коммит
55c6905c8b
|
@ -94,6 +94,25 @@ function createModule(id) {
|
|||
});
|
||||
};
|
||||
|
||||
// A whitelist of modules from which the built-in chrome module may be
|
||||
// required. The idea is add all modules that depend on chrome to the whitelist
|
||||
// initially, and then remove them one by one, fixing any errors as we go along.
|
||||
// Once the whitelist is empty, we can remove the built-in chrome module from
|
||||
// the loader entirely.
|
||||
//
|
||||
// TODO: Remove this when the whitelist becomes empty
|
||||
let chromeWhitelist = [
|
||||
"devtools/server/main",
|
||||
"devtools/toolkit/transport/transport",
|
||||
"devtools/toolkit/transport/stream-utils",
|
||||
"devtools/toolkit/transport/packets",
|
||||
"devtools/toolkit/DevToolsUtils",
|
||||
"devtools/toolkit/event-emitter",
|
||||
"devtools/server/protocol",
|
||||
"devtools/server/actors/script",
|
||||
"devtools/styleinspector/css-logic",
|
||||
];
|
||||
|
||||
// Create a CommonJS loader with the following options:
|
||||
// - createSandbox:
|
||||
// A function that will be used to create sandboxes. It takes the name and
|
||||
|
@ -176,6 +195,17 @@ function WorkerDebuggerLoader(options) {
|
|||
throw new Error("can't require module without id!");
|
||||
}
|
||||
|
||||
// If the module to be required is the built-in chrome module, and the
|
||||
// requirer is not in the whitelist, return a vacuous object as if the
|
||||
// module was unavailable.
|
||||
//
|
||||
// TODO: Remove this when the whitelist becomes empty
|
||||
if (id === "chrome" && chromeWhitelist.indexOf(requirer.id) < 0) {
|
||||
return { CC: undefined, Cc: undefined, ChromeWorker: undefined,
|
||||
Cm: undefined, Ci: undefined, Cu: undefined, Cr: undefined,
|
||||
components: undefined };
|
||||
}
|
||||
|
||||
// Built-in modules are cached by id rather than URL, so try to find the
|
||||
// module to be required by id first.
|
||||
let module = modules[id];
|
||||
|
|
Загрузка…
Ссылка в новой задаче