Bug 1275078 - toolbox-init.js error handling tweaks from Positron. r=ochameau

MozReview-Commit-ID: LDjzdUTJikc

--HG--
extra : rebase_source : 7e6c96f9543f14f07c00ee79d9a3796292c7d04f
This commit is contained in:
J. Ryan Stinnett 2017-02-22 12:45:06 -06:00
Родитель 9896e105b8
Коммит ffd700eb00
1 изменённых файлов: 17 добавлений и 17 удалений

Просмотреть файл

@ -58,30 +58,30 @@ if (url.search.length > 1) {
// `iframe` is the targeted document to debug // `iframe` is the targeted document to debug
let iframe = host.wrappedJSObject ? host.wrappedJSObject.target let iframe = host.wrappedJSObject ? host.wrappedJSObject.target
: host.target; : host.target;
if (!iframe) {
throw new Error("Unable to find the targeted iframe to debug");
}
// Need to use a xray and query some interfaces to have // Need to use a xray and query some interfaces to have
// attributes and behavior expected by devtools codebase // attributes and behavior expected by devtools codebase
iframe = XPCNativeWrapper(iframe); iframe = XPCNativeWrapper(iframe);
iframe.QueryInterface(Ci.nsIFrameLoaderOwner); iframe.QueryInterface(Ci.nsIFrameLoaderOwner);
if (iframe) { // Fake a xul:tab object as we don't have one.
// Fake a xul:tab object as we don't have one. // linkedBrowser is the only one attribute being queried by client.getTab
// linkedBrowser is the only one attribute being queried by client.getTab let tab = { linkedBrowser: iframe };
let tab = { linkedBrowser: iframe };
if (!DebuggerServer.initialized) { if (!DebuggerServer.initialized) {
DebuggerServer.init(); DebuggerServer.init();
DebuggerServer.addBrowserActors(); DebuggerServer.addBrowserActors();
}
let client = new DebuggerClient(DebuggerServer.connectPipe());
yield client.connect();
// Creates a target for a given browser iframe.
let response = yield client.getTab({ tab });
let form = response.tab;
target = yield TargetFactory.forRemoteTab({client, form, chrome: false});
} else {
alert("Unable to find the targetted iframe to debug");
} }
let client = new DebuggerClient(DebuggerServer.connectPipe());
yield client.connect();
// Creates a target for a given browser iframe.
let response = yield client.getTab({ tab });
let form = response.tab;
target = yield TargetFactory.forRemoteTab({client, form, chrome: false});
} else { } else {
target = yield targetFromURL(url); target = yield targetFromURL(url);
} }