зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1539979 - Set type=content for DevTools toolbox frames when rebuild_frameloaders_on_remoteness_change is true;r=bgrins,nika
Depends on D26317 Differential Revision: https://phabricator.services.mozilla.com/D26319 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
027cdd0432
Коммит
85ba25b7cc
|
@ -213,7 +213,7 @@ function Toolbox(target, selectedTool, hostType, contentWindow, frameId,
|
|||
*/
|
||||
loader.lazyGetter(this, "direction", () => {
|
||||
// Get the direction from browser.xul document
|
||||
const top = this.win.top;
|
||||
const top = this.topWindow;
|
||||
const topDocEl = top.document.documentElement;
|
||||
const isRtl = top.getComputedStyle(topDocEl).direction === "rtl";
|
||||
return isRtl ? "rtl" : "ltr";
|
||||
|
@ -377,6 +377,15 @@ Toolbox.prototype = {
|
|||
return this._win;
|
||||
},
|
||||
|
||||
/**
|
||||
* When the toolbox is loaded in a frame with type="content", win.parent will not return
|
||||
* the parent Chrome window. This getter should return the parent Chrome window
|
||||
* regardless of the frame type. See Bug 1539979.
|
||||
*/
|
||||
get topWindow() {
|
||||
return this.win.windowRoot.ownerGlobal;
|
||||
},
|
||||
|
||||
/**
|
||||
* Shortcut to the document containing the toolbox UI
|
||||
*/
|
||||
|
@ -1165,12 +1174,12 @@ Toolbox.prototype = {
|
|||
|
||||
postMessage: function(msg) {
|
||||
// We sometime try to send messages in middle of destroy(), where the
|
||||
// toolbox iframe may already be detached and no longer have a parent.
|
||||
if (this.win.parent) {
|
||||
// toolbox iframe may already be detached.
|
||||
if (!this._destroyer) {
|
||||
// Toolbox document is still chrome and disallow identifying message
|
||||
// origin via event.source as it is null. So use a custom id.
|
||||
msg.frameId = this.frameId;
|
||||
this.win.parent.postMessage(msg, "*");
|
||||
this.topWindow.postMessage(msg, "*");
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче