Switch back to @mozilla.org/browser/clh;1 and fix tests
In Firefox 102, `-file` was being swallowed by `nsBrowserContentHandler`
in BrowserContentHandler.jsm, so ab7d916e0
overrode that by using the
same contract id for our main nsICommandLineHandler in
zotero-service.js. But `nsBrowserContentHandler` also handles `-chrome`,
which we were using in tests to pass runtests.html. There's no need to
pass in dynamically though -- we can just hard-code that and open the
window ourselves.
This commit is contained in:
parent
744e73bfdb
commit
722287b81a
6 changed files with 21 additions and 11 deletions
|
@ -65,8 +65,8 @@ skin zotero default chrome/skin/default/zotero/
|
|||
component {e4c61080-ec2d-11da-8ad9-0800200c9a66} components/zotero-service.js
|
||||
component {531828f8-a16c-46be-b9aa-14845c3b010f} components/zotero-service.js
|
||||
contract @zotero.org/Zotero;1 {e4c61080-ec2d-11da-8ad9-0800200c9a66}
|
||||
contract @mozilla.org/commandlinehandler/general-startup;1?type=zotero {531828f8-a16c-46be-b9aa-14845c3b010f}
|
||||
category command-line-handler m-zotero @mozilla.org/commandlinehandler/general-startup;1?type=zotero
|
||||
contract @mozilla.org/browser/clh;1 {531828f8-a16c-46be-b9aa-14845c3b010f}
|
||||
category command-line-handler m-zotero @mozilla.org/browser/clh;1
|
||||
|
||||
component {06a2ed11-d0a4-4ff0-a56f-a44545eee6ea} components/zotero-autocomplete.js
|
||||
contract @mozilla.org/autocomplete/search;1?name=zotero {06a2ed11-d0a4-4ff0-a56f-a44545eee6ea}
|
||||
|
|
|
@ -3,5 +3,5 @@ resource zotero-unit test/resource/
|
|||
resource zotero-unit-tests test/tests/
|
||||
|
||||
component {b8570031-be5e-46e8-9785-38cd50a5d911} test/components/zotero-unit.js
|
||||
contract @mozilla.org/commandlinehandler/general-startup;1?type=zotero-unit {b8570031-be5e-46e8-9785-38cd50a5d911}
|
||||
category command-line-handler m-zotero-unit @mozilla.org/commandlinehandler/general-startup;1?type=zotero-unit
|
||||
contract @zotero.org/zotero/tests-clh;1 {b8570031-be5e-46e8-9785-38cd50a5d911}
|
||||
category command-line-handler m-zotero-unit @zotero.org/zotero/tests-clh;1
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
***** END LICENSE BLOCK *****
|
||||
*/
|
||||
Components.utils.import("resource://gre/modules/ComponentUtils.jsm");
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function ZoteroUnit() {
|
||||
this.wrappedJSObject = this;
|
||||
|
@ -41,19 +42,27 @@ ZoteroUnit.prototype = {
|
|||
this.stopAt = cmdLine.handleFlagWithParam("stopAtTestFile", false);
|
||||
this.grep = cmdLine.handleFlagWithParam("grep", false);
|
||||
this.timeout = cmdLine.handleFlagWithParam("ZoteroTestTimeout", false);
|
||||
|
||||
if (this.tests) {
|
||||
Services.ww.openWindow(
|
||||
null,
|
||||
"chrome://zotero-unit/content/runtests.html",
|
||||
"_blank",
|
||||
"chrome,dialog=no,all",
|
||||
Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray)
|
||||
);
|
||||
cmdLine.preventDefault = true;
|
||||
}
|
||||
},
|
||||
|
||||
dump:function(x) {
|
||||
dump(x);
|
||||
},
|
||||
|
||||
contractID: "@mozilla.org/commandlinehandler/general-startup;1?type=zotero-unit",
|
||||
classDescription: "Zotero Unit Command Line Handler",
|
||||
classID: Components.ID("{b8570031-be5e-46e8-9785-38cd50a5d911}"),
|
||||
service: true,
|
||||
_xpcom_categories: [{category:"command-line-handler", entry:"m-zotero-unit"}],
|
||||
QueryInterface: ChromeUtils.generateQI([Components.interfaces.nsICommandLineHandler])
|
||||
};
|
||||
|
||||
|
||||
var NSGetFactory = ComponentUtils.generateNSGetFactory([ZoteroUnit]);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"></meta>
|
||||
|
|
|
@ -3,7 +3,7 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
|
|||
Components.utils.import("resource://gre/modules/osfile.jsm");
|
||||
var EventUtils = Components.utils.import("resource://zotero-unit/EventUtils.jsm");
|
||||
|
||||
var ZoteroUnit = Components.classes["@mozilla.org/commandlinehandler/general-startup;1?type=zotero-unit"].
|
||||
var ZoteroUnit = Components.classes["@zotero.org/zotero/tests-clh;1"].
|
||||
getService(Components.interfaces.nsISupports).
|
||||
wrappedJSObject;
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ ZOTERO_TEST=1 "$ROOT_DIR/app/scripts/dir_build" -q
|
|||
|
||||
makePath FX_PROFILE "$PROFILE"
|
||||
MOZ_NO_REMOTE=1 NO_EM_RESTART=1 "$Z_EXECUTABLE" -profile "$FX_PROFILE" \
|
||||
-chrome chrome://zotero-unit/content/runtests.html -test "$TESTS" -grep "$GREP" -ZoteroTest $Z_ARGS
|
||||
-test "$TESTS" -grep "$GREP" -ZoteroTest $Z_ARGS
|
||||
|
||||
# Check for success
|
||||
test -e "$PROFILE/success"
|
||||
|
|
Loading…
Reference in a new issue