mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
fb013ccc72
This commit fixes 2 issues specific to the firefox version of the extension: First issue concerns the computation the position of the border between the subwindows of the components tab which could go terribly wrong due to the fact that the innerwidth of the window is implicitly set to 10 when the owl devtools window is hidden. Second issue comes from changes in the runtime.onMessage method of browser which now requires to directly return the response instead of using the sendResponse method. Also perform a little cleanup on usage of browserInstance and in the manifest.
32 lines
874 B
JavaScript
32 lines
874 B
JavaScript
import { IS_FIREFOX, browserInstance } from "../utils";
|
|
|
|
let created = false;
|
|
|
|
// Try to load the owl panel each 1000 ms in case it (re)appears on the page later on
|
|
const checkInterval = setInterval(createPanelsIfOwl, 1000);
|
|
|
|
createPanelsIfOwl();
|
|
|
|
// Create the owl devtools panel if owl on the page is available at a sufficient version
|
|
function createPanelsIfOwl() {
|
|
if (created) {
|
|
clearInterval(checkInterval);
|
|
return;
|
|
}
|
|
browserInstance.devtools.inspectedWindow.eval(
|
|
"window.__OWL_DEVTOOLS__?.Fiber !== undefined;",
|
|
async (hasOwl) => {
|
|
if (!hasOwl || created) {
|
|
return;
|
|
}
|
|
clearInterval(checkInterval);
|
|
created = true;
|
|
browserInstance.devtools.panels.create(
|
|
"Owl",
|
|
"../../assets/icon128.png",
|
|
IS_FIREFOX ? "devtools_panel.html" : "devtools_app/devtools_panel.html"
|
|
);
|
|
}
|
|
);
|
|
}
|