Hello,
I am currently developing an addon with popup menu and panel (which is displayed when the user clicks on the menu), and I have a problem that I can’t solve on my own.
I would like to clarify that I am not an expert in web development (C++ / Python instead).
The bug:
- Instead of getting the panel and its contents, I get a completely blank window.
- The content is only “unlocked” after a manual right click on it (and with another trick described below).
- In Firefox 56, there is no problem: the panel is displayed correctly.
- In Firefox 57 & 58, the bug is present.
- Below I use
panel
type, but there is no difference withpopup
, ordetached_panel
. - Is similar to these links but there is still no explanation:
FF57 browser.windows.create() displays blank popup - #5 by mig
FF57 browser.windows.create() displays blank popup window - I tested my code on Linux systems: Debian 8, Fedora 23.
- browser.windows.update() is a temporary workaround…
Here is a test code allowing to reproduce the bug.
Inspiration is taken mainly from these pages:
- webextensions-examples/window-manipulator at main · mdn/webextensions-examples · GitHub
- Extension pages - Mozilla | MDN
Browser toolbar button with a popup (test.html
):
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<div class="panel">
<a href="#" id="search_cookie_manager">LINK</a>
</div>
<script src="test.js"></script>
</body>
</html>
JavaScript for the popup menu (test.js
):
(function(mycode) {
mycode(window, document);
}(function(window, document) {
function createWindow(createData) {
let creating = browser.windows.create(createData);
creating.then(() => {
console.log("The panel has been created");
});
}
document.addEventListener("click", (e) => {
// Send empty url
let createData = {
type: "panel",
url: "panel.html",
};
createWindow(createData);
e.preventDefault();
});
}));
As you can see, the click on the link allows the creation of a panel.
Here is the code of the panel (panel.html
):
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<p>test</p>
</body>
</html>
Trick: When I include a JS code in panel.html
with:
alert('hello');
… the html is displayed below:
If I compare the event recordings with the developer tool, I notice that the event “paint”
is not triggered automatically after the event “pageshow” as it is the case on Firefox 56.
The right click allows you to force its triggering.
Is there something I’m doing wrong? How can I explain these different behaviors in the 2 versions of Firefox? Is it documented?
Thank you for your time spent on my problem.