import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo

This commit is contained in:
Roy Tam 2018-01-19 03:59:58 +08:00
commit dcd9973243
150858 changed files with 23884658 additions and 0 deletions

View file

@ -0,0 +1,76 @@
"use strict";
var {classes: Cc, interfaces: Ci, utils: Cu, manager: Cm} = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
const { generateUUID } = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator);
function AboutPage(aboutHost, chromeURL, uriFlags) {
this.chromeURL = chromeURL;
this.aboutHost = aboutHost;
this.classID = Components.ID(generateUUID().number);
this.description = "BrowserTestUtils: " + aboutHost;
this.uriFlags = uriFlags;
}
AboutPage.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
getURIFlags(aURI) { // eslint-disable-line no-unused-vars
return this.uriFlags;
},
newChannel(aURI, aLoadInfo) {
let newURI = Services.io.newURI(this.chromeURL, null, null);
let channel = Services.io.newChannelFromURIWithLoadInfo(newURI,
aLoadInfo);
channel.originalURI = aURI;
if (this.uriFlags & Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT) {
channel.owner = null;
}
return channel;
},
createInstance(outer, iid) {
if (outer !== null) {
throw Cr.NS_ERROR_NO_AGGREGATION;
}
return this.QueryInterface(iid);
},
register() {
Cm.QueryInterface(Ci.nsIComponentRegistrar).registerFactory(
this.classID, this.description,
"@mozilla.org/network/protocol/about;1?what=" + this.aboutHost, this);
},
unregister() {
Cm.QueryInterface(Ci.nsIComponentRegistrar).unregisterFactory(
this.classID, this);
}
};
const gRegisteredPages = new Map();
addMessageListener("browser-test-utils:about-registration:register", msg => {
let {aboutModule, pageURI, flags} = msg.data;
if (gRegisteredPages.has(aboutModule)) {
gRegisteredPages.get(aboutModule).unregister();
}
let moduleObj = new AboutPage(aboutModule, pageURI, flags);
moduleObj.register();
gRegisteredPages.set(aboutModule, moduleObj);
sendAsyncMessage("browser-test-utils:about-registration:registered", aboutModule);
});
addMessageListener("browser-test-utils:about-registration:unregister", msg => {
let aboutModule = msg.data;
let moduleObj = gRegisteredPages.get(aboutModule);
if (moduleObj) {
moduleObj.unregister();
gRegisteredPages.delete(aboutModule);
}
sendAsyncMessage("browser-test-utils:about-registration:unregistered", aboutModule);
});

View file

@ -0,0 +1,71 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/Task.jsm", this);
Cu.import("resource://testing-common/ContentTaskUtils.jsm", this);
const AssertCls = Cu.import("resource://testing-common/Assert.jsm", null).Assert;
addMessageListener("content-task:spawn", function (msg) {
let id = msg.data.id;
let source = msg.data.runnable || "()=>{}";
function getStack(aStack) {
let frames = [];
for (let frame = aStack; frame; frame = frame.caller) {
frames.push(frame.filename + ":" + frame.name + ":" + frame.lineNumber);
}
return frames.join("\n");
}
var Assert = new AssertCls((err, message, stack) => {
sendAsyncMessage("content-task:test-result", {
id: id,
condition: !err,
name: err ? err.message : message,
stack: getStack(err ? err.stack : stack)
});
});
var ok = Assert.ok.bind(Assert);
var is = Assert.equal.bind(Assert);
var isnot = Assert.notEqual.bind(Assert);
function todo(expr, name) {
sendAsyncMessage("content-task:test-todo", {id, expr, name});
}
function info(name) {
sendAsyncMessage("content-task:test-info", {id, name});
}
try {
let runnablestr = `
(() => {
return (${source});
})();`
let runnable = eval(runnablestr);
let iterator = runnable.call(this, msg.data.arg);
Task.spawn(iterator).then((val) => {
sendAsyncMessage("content-task:complete", {
id: id,
result: val,
});
}, (e) => {
sendAsyncMessage("content-task:complete", {
id: id,
error: e.toString(),
});
});
} catch (e) {
sendAsyncMessage("content-task:complete", {
id: id,
error: e.toString(),
});
}
});

View file

@ -0,0 +1,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
addEventListener("load", function(event) {
let subframe = event.target != content.document;
sendAsyncMessage("browser-test-utils:loadEvent",
{subframe: subframe, url: event.target.documentURI});
}, true);