mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-04 07:40:42 +00:00
Bug 1261665 - Do not use devtools module in devtools addon before reloading. r=jryans
This commit is contained in:
parent
2304fa0495
commit
53d4c8efab
39
devtools/bootstrap.js
vendored
39
devtools/bootstrap.js
vendored
@ -74,11 +74,27 @@ function reload(event) {
|
||||
// We automatically reload the toolbox if we are on a browser tab
|
||||
// with a toolbox already opened
|
||||
let top = getTopLevelWindow(event.view)
|
||||
let isBrowser = top.location.href.includes("/browser.xul") && top.gDevToolsBrowser;
|
||||
let isBrowser = top.location.href.includes("/browser.xul");
|
||||
let reloadToolbox = false;
|
||||
if (isBrowser && top.gDevToolsBrowser.hasToolboxOpened) {
|
||||
reloadToolbox = top.gDevToolsBrowser.hasToolboxOpened(top);
|
||||
if (isBrowser && top.gBrowser) {
|
||||
// We do not use any devtools code before the call to Loader.jsm reload as
|
||||
// any attempt to use Loader.jsm to load a module will instanciate a new
|
||||
// Loader.
|
||||
let nbox = top.gBrowser.getNotificationBox();
|
||||
reloadToolbox =
|
||||
top.document.getAnonymousElementByAttribute(nbox, "class",
|
||||
"devtools-toolbox-bottom-iframe") ||
|
||||
top.document.getAnonymousElementByAttribute(nbox, "class",
|
||||
"devtools-toolbox-side-iframe") ||
|
||||
Services.wm.getMostRecentWindow("devtools:toolbox");
|
||||
}
|
||||
let browserConsole = Services.wm.getMostRecentWindow("devtools:webconsole");
|
||||
let reopenBrowserConsole = false;
|
||||
if (browserConsole) {
|
||||
browserConsole.close();
|
||||
reopenBrowserConsole = true;
|
||||
}
|
||||
|
||||
dump("Reload DevTools. (reload-toolbox:"+reloadToolbox+")\n");
|
||||
|
||||
// Invalidate xul cache in order to see changes made to chrome:// files
|
||||
@ -133,15 +149,6 @@ function reload(event) {
|
||||
}
|
||||
} else if (windowtype === "devtools:webide") {
|
||||
window.location.reload();
|
||||
} else if (windowtype === "devtools:webconsole") {
|
||||
// Browser console document can't just be reloaded.
|
||||
// HUDService is going to close it on unload.
|
||||
// Instead we have to manually toggle it.
|
||||
let HUDService = devtools.require("devtools/client/webconsole/hudservice");
|
||||
HUDService.toggleBrowserConsole()
|
||||
.then(() => {
|
||||
HUDService.toggleBrowserConsole();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,6 +166,14 @@ function reload(event) {
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
// Browser console document can't just be reloaded.
|
||||
// HUDService is going to close it on unload.
|
||||
// Instead we have to manually toggle it.
|
||||
if (reopenBrowserConsole) {
|
||||
let HUDService = devtools.require("devtools/client/webconsole/hudservice");
|
||||
HUDService.toggleBrowserConsole();
|
||||
}
|
||||
|
||||
actionOccurred("reloadAddonReload");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user