2015-03-07 12:18:27 -05:00
|
|
|
"use strict";
|
|
|
|
/*
|
|
|
|
***** BEGIN LICENSE BLOCK *****
|
|
|
|
|
|
|
|
Copyright © 2012 Center for History and New Media
|
|
|
|
George Mason University, Fairfax, Virginia, USA
|
|
|
|
http://zotero.org
|
|
|
|
|
|
|
|
This file is part of Zotero.
|
|
|
|
|
|
|
|
Zotero is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Affero General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Zotero is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
***** END LICENSE BLOCK *****
|
|
|
|
*/
|
2022-06-09 03:00:54 -04:00
|
|
|
Components.utils.import("resource://gre/modules/ComponentUtils.jsm");
|
2023-05-24 06:50:34 -04:00
|
|
|
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
2015-03-07 12:18:27 -05:00
|
|
|
|
|
|
|
function ZoteroUnit() {
|
|
|
|
this.wrappedJSObject = this;
|
|
|
|
}
|
|
|
|
ZoteroUnit.prototype = {
|
|
|
|
/* nsICommandLineHandler */
|
|
|
|
handle:function(cmdLine) {
|
2023-05-24 06:50:34 -04:00
|
|
|
this.tests = cmdLine.handleFlagWithParam("test", false);
|
|
|
|
this.noquit = cmdLine.handleFlag("noquit", false);
|
2015-03-23 23:52:36 -05:00
|
|
|
this.makeTestData = cmdLine.handleFlag("makeTestData", false);
|
|
|
|
this.noquit = !this.makeTestData && this.noquit;
|
|
|
|
this.runTests = !this.makeTestData;
|
2015-05-29 04:01:40 -04:00
|
|
|
this.bail = cmdLine.handleFlag("bail", false);
|
2016-12-16 04:21:21 -05:00
|
|
|
this.startAt = cmdLine.handleFlagWithParam("startAtTestFile", false);
|
2017-06-20 00:47:13 -04:00
|
|
|
this.stopAt = cmdLine.handleFlagWithParam("stopAtTestFile", false);
|
2015-05-31 03:27:03 -04:00
|
|
|
this.grep = cmdLine.handleFlagWithParam("grep", false);
|
2016-04-26 02:16:37 -04:00
|
|
|
this.timeout = cmdLine.handleFlagWithParam("ZoteroTestTimeout", false);
|
2023-05-24 06:50:34 -04:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
2015-03-07 12:18:27 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
dump:function(x) {
|
|
|
|
dump(x);
|
|
|
|
},
|
|
|
|
|
|
|
|
classID: Components.ID("{b8570031-be5e-46e8-9785-38cd50a5d911}"),
|
|
|
|
service: true,
|
|
|
|
_xpcom_categories: [{category:"command-line-handler", entry:"m-zotero-unit"}],
|
2020-06-30 02:08:08 -04:00
|
|
|
QueryInterface: ChromeUtils.generateQI([Components.interfaces.nsICommandLineHandler])
|
2015-03-07 12:18:27 -05:00
|
|
|
};
|
|
|
|
|
2022-06-09 03:00:54 -04:00
|
|
|
var NSGetFactory = ComponentUtils.generateNSGetFactory([ZoteroUnit]);
|