Bug 1416505 - Fix popup blank for oop extensions.
MozReview-Commit-ID: 84p7HvH8CFG
--- a/browser/components/extensions/ExtensionPopups.jsm
+++ b/browser/components/extensions/ExtensionPopups.jsm
@@ -514,16 +514,25 @@ class ViewPopup extends BasePopup {
if (this.dimensions) {
if (this.fixedWidth) {
delete this.dimensions.width;
}
this.resizeBrowser(this.dimensions);
}
+ // Force a redraw of the popup content as a workaround for
+ // rendering issues of the "oop extension" popup content
+ // (See Bug 1416505 for a rationale).
+ this.window.promiseDocumentFlushed(() => {
+ if (!this.destroyed && this.browser && this.browser.isRemoteBrowser) {
+ this.browser.messageManager.sendAsyncMessage("Extension:ForceRedraw");
+ }
+ });
+
this.viewNode.customRectGetter = () => {
return {height: this.lastCalculatedInViewHeight || this.viewHeight};
};
this.tempPanel.remove();
this.tempPanel = null;
this.shown = true;
--- a/toolkit/components/extensions/ext-browser-content.js
+++ b/toolkit/components/extensions/ext-browser-content.js
@@ -113,16 +113,25 @@ const BrowserListener = {
if (this.unblockParser) {
this.unblockParser();
this.blockingPromise = null;
}
} else if (name === "Extension:GrabFocus") {
content.window.requestAnimationFrame(() => {
Services.focus.focusedWindow = content.window;
});
+ } else if (name === "Extension:ForceRedraw") {
+ // Force a redraw of the popup content as a workaround for
+ // rendering issues of the "oop extension" popup content
+ // (See Bug 1416505 for a rationale).
+ const dwu = content.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils);
+ content.requestAnimationFrame(() => {
+ dwu.redraw();
+ });
}
},
loadStylesheets() {
let winUtils = getWinUtils(content);
for (let url of this.stylesheets) {
winUtils.addSheet(ExtensionCommon.stylesheetMap.get(url), winUtils.AGENT_SHEET);
@@ -304,16 +313,17 @@ const BrowserListener = {
sendAsyncMessage("Extension:BrowserResized", result);
},
};
addMessageListener("Extension:InitBrowser", BrowserListener);
addMessageListener("Extension:UnblockParser", BrowserListener);
addMessageListener("Extension:GrabFocus", BrowserListener);
+addMessageListener("Extension:ForceRedraw", BrowserListener);
var WebBrowserChrome = {
onBeforeLinkTraversal(originalTarget, linkURI, linkNode, isAppTab) {
// isAppTab is the value for the docShell that received the click. We're
// handling this in the top-level frame and want traversal behavior to
// match the value for this frame rather than any subframe, so we pass
// through the docShell.isAppTab value rather than what we were handed.
return BrowserUtils.onBeforeLinkTraversal(originalTarget, linkURI, linkNode, docShell.isAppTab);