mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-21 07:47:32 +09:00
Import Tycho weave client
This commit is contained in:
parent
e4ac0e17f8
commit
c53787dfdb
183 changed files with 7272 additions and 16759 deletions
|
|
@ -5,9 +5,9 @@
|
|||
var EXPORTED_SYMBOLS = ["MozMillController", "globalEventRegistry",
|
||||
"sleep", "windowMap"];
|
||||
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
var EventUtils = {}; Cu.import('resource://mozmill/stdlib/EventUtils.js', EventUtils);
|
||||
|
||||
|
|
@ -44,11 +44,7 @@ waitForEvents.prototype = {
|
|||
node.firedEvents = {};
|
||||
this.registry = {};
|
||||
|
||||
if (!events) {
|
||||
return;
|
||||
}
|
||||
for (var key in events) {
|
||||
var e = events[key];
|
||||
for each (var e in events) {
|
||||
var listener = function (event) {
|
||||
this.firedEvents[event.type] = true;
|
||||
}
|
||||
|
|
@ -870,7 +866,7 @@ MozMillController.prototype.mouseMove = function (doc, start, dest) {
|
|||
|
||||
/**
|
||||
* Drag an element to the specified offset on another element, firing mouse and
|
||||
* drag events. Adapted from EventUtils.js synthesizeDrop()
|
||||
* drag events. Adapted from ChromeUtils.js synthesizeDrop()
|
||||
*
|
||||
* @deprecated Use the MozMillElement object
|
||||
*
|
||||
|
|
@ -977,10 +973,7 @@ function browserAdditions (controller) {
|
|||
return windows.map.hasPageLoaded(utils.getWindowId(win));
|
||||
}, "Timeout", timeout, aInterval);
|
||||
}
|
||||
catch (ex) {
|
||||
if (!(ex instanceof errors.TimeoutError)) {
|
||||
throw ex;
|
||||
}
|
||||
catch (ex if ex instanceof errors.TimeoutError) {
|
||||
timed_out = true;
|
||||
}
|
||||
finally {
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ var EXPORTED_SYMBOLS = ["ID", "Link", "XPath", "Selector", "Name", "Anon", "Anon
|
|||
"Lookup", "_byID", "_byName", "_byAttrib", "_byAnonAttrib",
|
||||
];
|
||||
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
|
|
@ -304,7 +304,7 @@ var _returnResult = function (results) {
|
|||
|
||||
var _forChildren = function (element, name, value) {
|
||||
var results = [];
|
||||
var nodes = Array.from(element.childNodes).filter(e => e);
|
||||
var nodes = [e for each (e in element.childNodes) if (e)]
|
||||
|
||||
for (var i in nodes) {
|
||||
var n = nodes[i];
|
||||
|
|
@ -318,7 +318,7 @@ var _forChildren = function (element, name, value) {
|
|||
|
||||
var _forAnonChildren = function (_document, element, name, value) {
|
||||
var results = [];
|
||||
var nodes = Array.from(_document.getAnoymousNodes(element)).filter(e => e);
|
||||
var nodes = [e for each (e in _document.getAnoymousNodes(element)) if (e)];
|
||||
|
||||
for (var i in nodes ) {
|
||||
var n = nodes[i];
|
||||
|
|
@ -381,7 +381,7 @@ var _byAnonAttrib = function (_document, parent, attributes) {
|
|||
}
|
||||
}
|
||||
|
||||
var nodes = Array.from(_document.getAnonymousNodes(parent)).filter(n => n.getAttribute);
|
||||
var nodes = [n for each (n in _document.getAnonymousNodes(parent)) if (n.getAttribute)];
|
||||
|
||||
function resultsForNodes (nodes) {
|
||||
for (var i in nodes) {
|
||||
|
|
@ -404,7 +404,7 @@ var _byAnonAttrib = function (_document, parent, attributes) {
|
|||
|
||||
resultsForNodes(nodes);
|
||||
if (results.length == 0) {
|
||||
resultsForNodes(Array.from(parent.childNodes).filter(n => n != undefined && n.getAttribute));
|
||||
resultsForNodes([n for each (n in parent.childNodes) if (n != undefined && n.getAttribute)])
|
||||
}
|
||||
|
||||
return _returnResult(results)
|
||||
|
|
@ -440,7 +440,7 @@ function Lookup(_document, expression) {
|
|||
throw new Error('Lookup constructor did not recieve enough arguments.');
|
||||
}
|
||||
|
||||
var expSplit = smartSplit(expression).filter(e => e != '');
|
||||
var expSplit = [e for each (e in smartSplit(expression) ) if (e != '')];
|
||||
expSplit.unshift(_document);
|
||||
|
||||
var nCases = {'id':_byID, 'name':_byName, 'attrib':_byAttrib, 'index':_byIndex};
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ var EXPORTED_SYMBOLS = ["Elem", "Selector", "ID", "Link", "XPath", "Name", "Look
|
|||
|
||||
const NAMESPACE_XUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
var EventUtils = {}; Cu.import('resource://mozmill/stdlib/EventUtils.js', EventUtils);
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ MozMillElement.prototype.__defineGetter__("element", function () {
|
|||
|
||||
/**
|
||||
* Drag an element to the specified offset on another element, firing mouse and
|
||||
* drag events. Adapted from EventUtils.js synthesizeDrop()
|
||||
* drag events. Adapted from ChromeUtils.js synthesizeDrop()
|
||||
*
|
||||
* By default it will drag the source element over the destination's element
|
||||
* center with a "move" dropEffect.
|
||||
|
|
@ -218,7 +218,7 @@ MozMillElement.prototype.dragToElement = function(aElement, aOffsetX, aOffsetY,
|
|||
EventUtils.synthesizeMouse(destNode, destCoords.x, destCoords.y,
|
||||
{ type: "mousemove" }, destWindow);
|
||||
|
||||
var event = destWindow.document.createEvent("DragEvent");
|
||||
var event = destWindow.document.createEvent("DragEvents");
|
||||
event.initDragEvent("dragenter", true, true, destWindow, 0, 0, 0, 0, 0,
|
||||
false, false, false, false, 0, null, dataTransfer);
|
||||
event.initDragEvent("dragover", true, true, destWindow, 0, 0, 0, 0, 0,
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ var EXPORTED_SYMBOLS = ["controller", "utils", "elementslib", "os",
|
|||
"firePythonCallback", "getAddons"
|
||||
];
|
||||
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
|
||||
Cu.import("resource://gre/modules/AddonManager.jsm");
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
var EXPORTED_SYMBOLS = ['Assert', 'Expect'];
|
||||
|
||||
var Cu = Components.utils;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
|
|
@ -658,10 +658,7 @@ Expect.prototype.waitFor = function Expect_waitFor(aCallback, aMessage, aTimeout
|
|||
try {
|
||||
Assert.prototype.waitFor.apply(this, arguments);
|
||||
}
|
||||
catch (ex) {
|
||||
if (!(ex instanceof errors.AssertionError)) {
|
||||
throw ex;
|
||||
}
|
||||
catch (ex if ex instanceof errors.AssertionError) {
|
||||
message = ex.message;
|
||||
condition = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
var EXPORTED_SYMBOLS = ['Collector','Runner','events', 'runTestFile', 'log',
|
||||
'timers', 'persisted', 'shutdownApplication'];
|
||||
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
const TIMEOUT_SHUTDOWN_HTTPD = 15000;
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ events.pass = function (obj) {
|
|||
events.currentTest.__passes__.push(obj);
|
||||
}
|
||||
|
||||
for (var timer of timers) {
|
||||
for each (var timer in timers) {
|
||||
timer.actions.push(
|
||||
{"currentTest": events.currentModule.__file__ + "::" + events.currentTest.__name__,
|
||||
"obj": obj,
|
||||
|
|
@ -286,7 +286,7 @@ events.fail = function (obj) {
|
|||
events.currentTest.__fails__.push(obj);
|
||||
}
|
||||
|
||||
for (var time of timers) {
|
||||
for each (var time in timers) {
|
||||
timer.actions.push(
|
||||
{"currentTest": events.currentModule.__file__ + "::" + events.currentTest.__name__,
|
||||
"obj": obj,
|
||||
|
|
@ -325,7 +325,7 @@ events.fireEvent = function (name, obj) {
|
|||
}
|
||||
}
|
||||
|
||||
for (var listener of this.globalListeners) {
|
||||
for each(var listener in this.globalListeners) {
|
||||
listener(name, obj);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
var EXPORTED_SYMBOLS = ["init", "map"];
|
||||
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
// imports
|
||||
var utils = {}; Cu.import('resource://mozmill/stdlib/utils.js', utils);
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ var EXPORTED_SYMBOLS = ["disableNonTestMouseEvents","sendMouseEvent", "sendChar"
|
|||
"synthesizeText",
|
||||
"synthesizeComposition", "synthesizeQuerySelectedText"];
|
||||
|
||||
var Ci = Components.interfaces;
|
||||
var Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
|
||||
var window = Cc["@mozilla.org/appshell/appShellService;1"]
|
||||
.getService(Ci.nsIAppShellService).hiddenDOMWindow;
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
var EXPORTED_SYMBOLS = ['listDirectory', 'getFileForPath', 'abspath', 'getPlatform'];
|
||||
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ function abspath(rel, file) {
|
|||
file = file.parent;
|
||||
}
|
||||
|
||||
for (var p of relSplit) {
|
||||
for each(var p in relSplit) {
|
||||
if (p == '..') {
|
||||
file = file.parent;
|
||||
} else if (p == '.') {
|
||||
|
|
|
|||
|
|
@ -40,8 +40,6 @@
|
|||
const Cu = Components.utils;
|
||||
const Cr = Components.results;
|
||||
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
var exports = {};
|
||||
|
||||
var ios = Cc['@mozilla.org/network/io-service;1']
|
||||
|
|
@ -170,7 +168,8 @@
|
|||
if (rootPaths) {
|
||||
if (rootPaths.constructor.name != "Array")
|
||||
rootPaths = [rootPaths];
|
||||
var fses = rootPaths.map(path => new exports.LocalFileSystem(path));
|
||||
var fses = [new exports.LocalFileSystem(path)
|
||||
for each (path in rootPaths)];
|
||||
options.fs = new exports.CompositeFileSystem(fses);
|
||||
} else
|
||||
options.fs = new exports.LocalFileSystem();
|
||||
|
|
@ -315,26 +314,17 @@
|
|||
else
|
||||
baseURI = ios.newURI(base, null, null);
|
||||
var newURI = ios.newURI(path, null, baseURI);
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: newURI,
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var channel = ios.newChannelFromURI(newURI);
|
||||
try {
|
||||
channel.open2().close();
|
||||
} catch (e) {
|
||||
if (e.result != Cr.NS_ERROR_FILE_NOT_FOUND) {
|
||||
throw e;
|
||||
}
|
||||
channel.open().close();
|
||||
} catch (e if e.result == Cr.NS_ERROR_FILE_NOT_FOUND) {
|
||||
return null;
|
||||
}
|
||||
return newURI.spec;
|
||||
},
|
||||
getFile: function getFile(path) {
|
||||
var channel = NetUtil.newChannel({
|
||||
uri: path,
|
||||
loadUsingSystemPrincipal: true
|
||||
});
|
||||
var iStream = channel.open2();
|
||||
var channel = ios.newChannel(path, null, null);
|
||||
var iStream = channel.open();
|
||||
var ciStream = Cc["@mozilla.org/intl/converter-input-stream;1"].
|
||||
createInstance(Ci.nsIConverterInputStream);
|
||||
var bufLen = 0x8000;
|
||||
|
|
|
|||
|
|
@ -10,16 +10,16 @@ var EXPORTED_SYMBOLS = ["applicationName", "assert", "Copy", "getBrowserObject",
|
|||
"unwrapNode", "waitFor"
|
||||
];
|
||||
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const applicationIdMap = {
|
||||
'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}': 'Firefox'
|
||||
'{8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4}': 'Firefox'
|
||||
}
|
||||
const applicationName = applicationIdMap[Services.appinfo.ID] || Services.appinfo.name;
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ function getWindows(type) {
|
|||
}
|
||||
|
||||
function getMethodInWindows(methodName) {
|
||||
for (var w of getWindows()) {
|
||||
for each (var w in getWindows()) {
|
||||
if (w[methodName] != undefined) {
|
||||
return w[methodName];
|
||||
}
|
||||
|
|
@ -93,7 +93,7 @@ function getMethodInWindows(methodName) {
|
|||
}
|
||||
|
||||
function getWindowByTitle(title) {
|
||||
for (var w of getWindows()) {
|
||||
for each (var w in getWindows()) {
|
||||
if (w.document.title && w.document.title == title) {
|
||||
return w;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue