fx-compat: Get basicViewer working for debug output

Doesn't work with, e.g., zotero://timeline/library
This commit is contained in:
Dan Stillman 2022-05-13 03:49:23 -04:00
parent 88afb2c495
commit da9154d811
5 changed files with 59 additions and 28 deletions

View file

@ -1017,7 +1017,7 @@ var Zotero_File_Interface = new function() {
const arg = Components.classes["@mozilla.org/supports-string;1"]
.createInstance(Components.interfaces.nsISupportsString);
arg.data = uri;
win = ww.openWindow(null, "chrome://zotero/content/standalone/basicViewer.xul",
win = ww.openWindow(null, "chrome://zotero/content/standalone/basicViewer.xhtml",
"basicViewer", "chrome,dialog=yes,resizable,centerscreen,menubar,scrollbars", arg);
}

View file

@ -141,7 +141,7 @@ var Zotero_Preferences = {
if(win) {
win.loadURI(uri);
} else {
window.openDialog("chrome://zotero/content/standalone/basicViewer.xul",
window.openDialog("chrome://zotero/content/standalone/basicViewer.xhtml",
"basicViewer", "chrome,resizable,centerscreen,menubar,scrollbars", uri);
}
} else {

View file

@ -23,28 +23,44 @@
***** END LICENSE BLOCK *****
*/
var browser;
function loadURI() {
browser.loadURI.apply(browser, arguments);
}
/*const { E10SUtils } = ChromeUtils.import(
"resource://gre/modules/E10SUtils.jsm"
);*/
window.addEventListener("load", function() {
browser = document.getElementById('my-browser');
var browser;
window.addEventListener("load", /*async */function() {
browser = document.querySelector('browser');
/*
browser.setAttribute("remote", "true");
//browser.setAttribute("remoteType", E10SUtils.EXTENSION_REMOTE_TYPE);
await new Promise((resolve) => {
browser.addEventListener("XULFrameLoaderCreated", () => resolve());
});
*/
/*browser.messageManager.loadFrameScript(
'chrome://zotero/content/standalone/basicViewerContent.js',
false
);*/
//browser.docShellIsActive = false;
// align page title with title of shown document
browser.addEventListener("pageshow", function() {
document.title = (browser.contentDocument.title
? browser.contentDocument.title
: browser.contentDocument.location.href);
document.title = browser.contentDocument.title || browser.contentDocument.location.href;
}, false);
// show document
browser.loadURI.apply(browser, window.arguments);
// Load URI passed in as nsISupports .data via openWindow()
browser.loadURI(
window.arguments[0],
{
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
//loadFlags: Ci.nsIWebNavigation.LOAD_FLAGS_STOP_CONTENT,
}
);
// XXX Why is this necessary to make the scroll bars appear?
window.setTimeout(function() {
document.getElementById("my-browser").style.overflow = "auto";
}, 0);
}, false);
window.addEventListener("keypress", function (event) {

View file

@ -33,7 +33,7 @@
<!DOCTYPE window [
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd"> %globalDTD;
<!ENTITY % textcontextDTD SYSTEM "chrome://global/locale/textcontext.dtd" > %textcontextDTD;
<!--<!ENTITY % textcontextDTD SYSTEM "chrome://global/locale/textcontext.dtd" > %textcontextDTD;-->
<!ENTITY % standaloneDTD SYSTEM "chrome://zotero/locale/standalone.dtd" > %standaloneDTD;
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" > %brandDTD;
<!ENTITY % zoteroDTD SYSTEM "chrome://zotero/locale/zotero.dtd"> %zoteroDTD;
@ -46,12 +46,23 @@
title="&brandShortName;"
width="1000" height="700"
persist="screenX screenY width height sizemode">
<script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
<script type="application/javascript" src="chrome://global/content/contentAreaUtils.js"/>
<script type="application/javascript" src="chrome://global/content/printUtils.js"/>
<script type="application/javascript" src="chrome://global/content/inlineSpellCheckUI.js"/>
<script type="application/javascript" src="chrome://zotero/content/include.js"/>
<script type="application/javascript" src="basicViewer.js"/>
<script>
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
Services.scriptloader.loadSubScript("chrome://zotero/content/include.js", this);
// Mozilla scripts
Services.scriptloader.loadSubScript("chrome://global/content/globalOverlay.js", this);
Services.scriptloader.loadSubScript("chrome://global/content/editMenuOverlay.js", this);
Services.scriptloader.loadSubScript("chrome://global/content/contentAreaUtils.js", this);
Services.scriptloader.loadSubScript("chrome://global/content/printUtils.js", this);
if (Zotero.isMac) {
Services.scriptloader.loadSubScript("chrome://global/content/macWindowMenu.js", this);
}
Services.scriptloader.loadSubScript("chrome://zotero/content/standalone/basicViewer.js", this);
</script>
<commandset id="mainCommandSet">
<!--FILE-->
@ -73,7 +84,7 @@
</keyset>
<keyset id="editMenuKeys"/>
<popup id="contentAreaContextMenu">
<!--<popup id="contentAreaContextMenu">
<menuitem id="context-undo"
label="&undoCmd.label;"
accesskey="&undoCmd.accesskey;"
@ -100,7 +111,7 @@
label="&selectAllCmd.label;"
accesskey="&selectAllCmd.accesskey;"
command="cmd_selectAll"/>
</popup>
</popup>-->
<toolbox id="navigator-toolbox" class="toolbox-top" mode="icons" defaultmode="icons">
<!-- Menu -->
<toolbar type="menubar" id="toolbar-menubar" class="chromeclass-menubar" customizable="true"
@ -155,7 +166,11 @@
<hbox flex="1" id="browser">
<vbox id="appcontent" flex="1">
<browser id="my-browser" type="content" flex="1"/>
<browser
type="content"
flex="1"
remote="false"
disableglobalhistory="true"/>
</vbox>
</hbox>
</window>

View file

@ -1109,7 +1109,7 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
let arg = Components.classes["@mozilla.org/supports-string;1"]
.createInstance(Components.interfaces.nsISupportsString);
arg.data = uri;
win = ww.openWindow(null, "chrome://zotero/content/standalone/basicViewer.xul",
win = ww.openWindow(null, "chrome://zotero/content/standalone/basicViewer.xhtml",
"basicViewer", "chrome,dialog=yes,resizable,centerscreen,menubar,scrollbars", arg);
}
if (onLoad) {