mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 937f571f4655 (bug 946813)
This commit is contained in:
parent
3acd3d9d78
commit
85a286cad3
@ -35,7 +35,6 @@ let loaderGlobals = {
|
||||
btoa: btoa,
|
||||
console: console,
|
||||
_Iterator: Iterator,
|
||||
ChromeWorker: ChromeWorker,
|
||||
loader: {
|
||||
lazyGetter: XPCOMUtils.defineLazyGetter.bind(XPCOMUtils),
|
||||
lazyImporter: XPCOMUtils.defineLazyModuleGetter.bind(XPCOMUtils),
|
||||
|
@ -15,11 +15,31 @@ const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
const Cu = Components.utils;
|
||||
|
||||
const { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["DebuggerServer", "ActorPool"];
|
||||
|
||||
let server = devtools.require("devtools/server/main");
|
||||
var loadSubScript =
|
||||
"function loadSubScript(aURL)\n" +
|
||||
"{\n" +
|
||||
"const Ci = Components.interfaces;\n" +
|
||||
"const Cc = Components.classes;\n" +
|
||||
" try {\n" +
|
||||
" let loader = Cc[\"@mozilla.org/moz/jssubscript-loader;1\"]\n" +
|
||||
" .getService(Ci.mozIJSSubScriptLoader);\n" +
|
||||
" loader.loadSubScript(aURL, this);\n" +
|
||||
" } catch(e) {\n" +
|
||||
" dump(\"Error loading: \" + aURL + \": \" + e + \" - \" + e.stack + \"\\n\");\n" +
|
||||
" throw e;\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
|
||||
this.DebuggerServer = server.DebuggerServer;
|
||||
this.ActorPool = server.ActorPool;
|
||||
// Load the debugging server in a sandbox with its own compartment.
|
||||
var systemPrincipal = Cc["@mozilla.org/systemprincipal;1"]
|
||||
.createInstance(Ci.nsIPrincipal);
|
||||
|
||||
var gGlobal = Cu.Sandbox(systemPrincipal);
|
||||
gGlobal.ChromeWorker = ChromeWorker;
|
||||
Cu.evalInSandbox(loadSubScript, gGlobal, "1.8");
|
||||
gGlobal.loadSubScript("resource://gre/modules/devtools/server/main.js");
|
||||
|
||||
this.DebuggerServer = gGlobal.DebuggerServer;
|
||||
this.ActorPool = gGlobal.ActorPool;
|
||||
|
@ -10,22 +10,36 @@
|
||||
* debugging global.
|
||||
*/
|
||||
|
||||
// Until all Debugger server code is converted to SDK modules,
|
||||
// imports Components.* alias from chrome module.
|
||||
var { Ci, Cc, CC, Cu, Cr } = require("chrome");
|
||||
// On B2G, `this` != Global scope, so `Ci` won't be binded on `this`
|
||||
// (i.e. this.Ci is undefined) Then later, when using loadSubScript,
|
||||
// Ci,... won't be defined for sub scripts.
|
||||
this.Ci = Ci;
|
||||
this.Cc = Cc;
|
||||
this.CC = CC;
|
||||
this.Cu = Cu;
|
||||
this.Cr = Cr;
|
||||
// Overload `Components` to prevent SDK loader exception on Components
|
||||
// object usage
|
||||
Object.defineProperty(this, "Components", {
|
||||
get: function () require("chrome").components
|
||||
});
|
||||
// |this.require| is used to test if this file was loaded via the devtools
|
||||
// loader (as it is in DebuggerProcess.jsm) or via loadSubScript (as it is from
|
||||
// dbg-server.jsm). Note that testing |require| is not safe in either
|
||||
// situation, as it causes a ReferenceError.
|
||||
var Ci, Cc, CC, Cu, Cr, Components;
|
||||
if (this.require) {
|
||||
({ Ci, Cc, CC, Cu, Cr, components: Components }) = require("chrome");
|
||||
} else {
|
||||
({
|
||||
interfaces: Ci,
|
||||
classes: Cc,
|
||||
Constructor: CC,
|
||||
utils: Cu,
|
||||
results: Cr
|
||||
}) = Components;
|
||||
}
|
||||
|
||||
// On B2G, if |this.require| is undefined at this point, it remains undefined
|
||||
// later on when |DebuggerServer.registerModule| is called. On desktop (and
|
||||
// perhaps other places), if |this.require| starts out undefined, it ends up
|
||||
// being set to some native code by the time we get to |registerModule|. Here
|
||||
// we perform a test early on, and then cache the correct require function for
|
||||
// later use.
|
||||
var localRequire;
|
||||
if (this.require) {
|
||||
localRequire = id => require(id);
|
||||
} else {
|
||||
let { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
localRequire = id => devtools.require(id);
|
||||
}
|
||||
|
||||
const DBG_STRINGS_URI = "chrome://global/locale/devtools/debugger.properties";
|
||||
|
||||
@ -54,12 +68,10 @@ function loadSubScript(aURL)
|
||||
}
|
||||
}
|
||||
|
||||
let {defer, resolve, reject, promised, all} = require("sdk/core/promise");
|
||||
this.defer = defer;
|
||||
this.resolve = resolve;
|
||||
this.reject = reject;
|
||||
this.promised = promised;
|
||||
this.all = all;
|
||||
let loaderRequire = this.require;
|
||||
this.require = null;
|
||||
loadSubScript.call(this, "resource://gre/modules/commonjs/sdk/core/promise.js");
|
||||
this.require = loaderRequire;
|
||||
|
||||
Cu.import("resource://gre/modules/devtools/SourceMap.jsm");
|
||||
|
||||
@ -70,14 +82,12 @@ function dumpn(str) {
|
||||
dump("DBG-SERVER: " + str + "\n");
|
||||
}
|
||||
}
|
||||
this.dumpn = dumpn;
|
||||
|
||||
function dbg_assert(cond, e) {
|
||||
if (!cond) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
this.dbg_assert = dbg_assert;
|
||||
|
||||
loadSubScript.call(this, "resource://gre/modules/devtools/server/transport.js");
|
||||
|
||||
@ -314,7 +324,7 @@ var DebuggerServer = {
|
||||
}
|
||||
|
||||
let moduleAPI = ModuleAPI();
|
||||
let mod = require(id);
|
||||
let mod = localRequire(id);
|
||||
mod.register(moduleAPI);
|
||||
gRegisteredModules[id] = { module: mod, api: moduleAPI };
|
||||
},
|
||||
@ -680,8 +690,6 @@ var DebuggerServer = {
|
||||
if (this.exports) {
|
||||
exports.DebuggerServer = DebuggerServer;
|
||||
}
|
||||
// Needed on B2G (See header note)
|
||||
this.DebuggerServer = DebuggerServer;
|
||||
|
||||
/**
|
||||
* Construct an ActorPool.
|
||||
@ -700,8 +708,6 @@ function ActorPool(aConnection)
|
||||
if (this.exports) {
|
||||
exports.ActorPool = ActorPool;
|
||||
}
|
||||
// Needed on B2G (See header note)
|
||||
this.ActorPool = ActorPool;
|
||||
|
||||
ActorPool.prototype = {
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user