зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1508983 - Enable ESLint for dom/base/test/chrome (automatic changes) r=Standard8,smaug
Differential Revision: https://phabricator.services.mozilla.com/D13128 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
a60bf34a68
Коммит
e45d6338be
|
@ -1,5 +1,5 @@
|
|||
// The main test function.
|
||||
var test = function (isContent) {
|
||||
var test = function(isContent) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
SpecialPowers.pushPrefEnv({"set": [["security.allow_eval_with_system_principal",
|
||||
|
@ -28,38 +28,36 @@ var test = function (isContent) {
|
|||
["screen.orientation.type", "'landscape-primary'"],
|
||||
["screen.orientation.angle", 0],
|
||||
["screen.mozOrientation", "'landscape-primary'"],
|
||||
["devicePixelRatio", 1]
|
||||
["devicePixelRatio", 1],
|
||||
];
|
||||
|
||||
// checkPair: tests if members of pair [a, b] are equal when evaluated.
|
||||
let checkPair = function (a, b) {
|
||||
let checkPair = function(a, b) {
|
||||
is(eval(a), eval(b), a + " should be equal to " + b);
|
||||
};
|
||||
|
||||
// Returns generator object that iterates through pref values.
|
||||
let prefVals = (function*() { yield false; yield true; })();
|
||||
let prefVals = (function* () { yield false; yield true; })();
|
||||
|
||||
// The main test function, runs until all pref values are exhausted.
|
||||
let nextTest = function () {
|
||||
let {value : prefValue, done} = prefVals.next();
|
||||
let nextTest = function() {
|
||||
let {value: prefValue, done} = prefVals.next();
|
||||
if (done) {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
SpecialPowers.pushPrefEnv({set : [["privacy.resistFingerprinting", prefValue]]},
|
||||
function () {
|
||||
SpecialPowers.pushPrefEnv({set: [["privacy.resistFingerprinting", prefValue]]},
|
||||
function() {
|
||||
// We will be resisting fingerprinting if the pref is enabled,
|
||||
// and we are in a content script (not chrome).
|
||||
let resisting = prefValue && isContent;
|
||||
// Check each of the pairs.
|
||||
pairs.map(function ([item, onVal]) {
|
||||
pairs.map(function([item, onVal]) {
|
||||
if (resisting) {
|
||||
checkPair("window." + item, onVal);
|
||||
} else {
|
||||
if (!item.startsWith("moz")) {
|
||||
} else if (!item.startsWith("moz")) {
|
||||
checkPair("window." + item, "chromeWindow." + item);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!resisting) {
|
||||
// Hard to predict these values, but we can enforce constraints:
|
||||
|
@ -70,7 +68,7 @@ var test = function (isContent) {
|
|||
}
|
||||
nextTest();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
nextTest();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
dump('loaded child cpow test\n');
|
||||
dump("loaded child cpow test\n");
|
||||
|
||||
Cu.importGlobalProperties(["XMLHttpRequest"]);
|
||||
|
||||
|
@ -41,28 +41,27 @@ Cu.importGlobalProperties(["XMLHttpRequest"]);
|
|||
})();
|
||||
|
||||
function ok(condition, message) {
|
||||
dump('condition: ' + condition + ', ' + message + '\n');
|
||||
dump("condition: " + condition + ", " + message + "\n");
|
||||
if (!condition) {
|
||||
sendAsyncMessage("cpows:fail", { message: message });
|
||||
sendAsyncMessage("cpows:fail", { message });
|
||||
}
|
||||
}
|
||||
|
||||
var sync_obj;
|
||||
var async_obj;
|
||||
|
||||
function make_object()
|
||||
{
|
||||
function make_object() {
|
||||
let o = { };
|
||||
o.i = 5;
|
||||
o.b = true;
|
||||
o.s = "hello";
|
||||
o.x = { i: 10 };
|
||||
o.f = function () { return 99; };
|
||||
o.ctor = function() { this.a = 3; }
|
||||
o.f = function() { return 99; };
|
||||
o.ctor = function() { this.a = 3; };
|
||||
|
||||
// Doing anything with this Proxy will throw.
|
||||
var throwing = new Proxy({}, new Proxy({}, {
|
||||
get: function (trap) { throw trap; }
|
||||
get(trap) { throw trap; },
|
||||
}));
|
||||
|
||||
let array = [1, 2, 3];
|
||||
|
@ -81,17 +80,15 @@ function make_object()
|
|||
"array": array,
|
||||
"for_json": for_json,
|
||||
"with_proto": with_proto,
|
||||
"with_null_proto": with_null_proto
|
||||
"with_null_proto": with_null_proto,
|
||||
};
|
||||
}
|
||||
|
||||
function make_json()
|
||||
{
|
||||
function make_json() {
|
||||
return { check: "ok" };
|
||||
}
|
||||
|
||||
function parent_test(finish)
|
||||
{
|
||||
function parent_test(finish) {
|
||||
function f(check_func) {
|
||||
// Make sure this doesn't crash.
|
||||
let array = new Uint32Array(10);
|
||||
|
@ -116,9 +113,9 @@ function parent_test(finish)
|
|||
// is callable from unprivileged content. Greasemonkey uses this
|
||||
// functionality.
|
||||
let func = msg.objects.func;
|
||||
let sb = Cu.Sandbox('http://www.example.com', {});
|
||||
let sb = Cu.Sandbox("http://www.example.com", {});
|
||||
sb.func = func;
|
||||
ok(sb.eval('func()') == 101, "can call parent's function in child");
|
||||
ok(sb.eval("func()") == 101, "can call parent's function in child");
|
||||
|
||||
finish();
|
||||
});
|
||||
|
@ -130,30 +127,27 @@ function error_reporting_test(finish) {
|
|||
finish();
|
||||
}
|
||||
|
||||
function dom_test(finish)
|
||||
{
|
||||
function dom_test(finish) {
|
||||
let element = content.document.createElement("div");
|
||||
element.id = "it_works";
|
||||
content.document.body.appendChild(element);
|
||||
|
||||
sendRpcMessage("cpows:dom_test", {}, {element: element});
|
||||
sendRpcMessage("cpows:dom_test", {}, {element});
|
||||
Cu.schedulePreciseGC(function() {
|
||||
sendRpcMessage("cpows:dom_test_after_gc");
|
||||
finish();
|
||||
});
|
||||
}
|
||||
|
||||
function xray_test(finish)
|
||||
{
|
||||
function xray_test(finish) {
|
||||
let element = content.document.createElement("div");
|
||||
element.wrappedJSObject.foo = "hello";
|
||||
|
||||
sendRpcMessage("cpows:xray_test", {}, {element: element});
|
||||
sendRpcMessage("cpows:xray_test", {}, {element});
|
||||
finish();
|
||||
}
|
||||
|
||||
function symbol_test(finish)
|
||||
{
|
||||
function symbol_test(finish) {
|
||||
let iterator = Symbol.iterator;
|
||||
let named = Symbol.for("cpow-test");
|
||||
|
||||
|
@ -161,15 +155,14 @@ function symbol_test(finish)
|
|||
[iterator]: iterator,
|
||||
[named]: named,
|
||||
};
|
||||
let test = ['a'];
|
||||
sendRpcMessage("cpows:symbol_test", {}, {object: object, test: test});
|
||||
let test = ["a"];
|
||||
sendRpcMessage("cpows:symbol_test", {}, {object, test});
|
||||
finish();
|
||||
}
|
||||
|
||||
// Parent->Child references should go X->parent.privilegedJunkScope->child.privilegedJunkScope->Y
|
||||
// Child->Parent references should go X->child.privilegedJunkScope->parent.unprivilegedJunkScope->Y
|
||||
function compartment_test(finish)
|
||||
{
|
||||
function compartment_test(finish) {
|
||||
// This test primarily checks various compartment invariants for CPOWs, and
|
||||
// doesn't make sense to run in-process.
|
||||
if (!is_remote) {
|
||||
|
@ -177,12 +170,12 @@ function compartment_test(finish)
|
|||
return;
|
||||
}
|
||||
|
||||
let sb = Cu.Sandbox('http://www.example.com', { wantGlobalProperties: ['XMLHttpRequest'] });
|
||||
sb.eval('function getUnprivilegedObject() { var xhr = new XMLHttpRequest(); xhr.expando = 42; return xhr; }');
|
||||
let sb = Cu.Sandbox("http://www.example.com", { wantGlobalProperties: ["XMLHttpRequest"] });
|
||||
sb.eval("function getUnprivilegedObject() { var xhr = new XMLHttpRequest(); xhr.expando = 42; return xhr; }");
|
||||
function testParentObject(obj) {
|
||||
let results = [];
|
||||
function is(a, b, msg) { results.push({ result: a === b ? "PASS" : "FAIL", message: msg }) };
|
||||
function ok(x, msg) { results.push({ result: x ? "PASS" : "FAIL", message: msg }) };
|
||||
function is(a, b, msg) { results.push({ result: a === b ? "PASS" : "FAIL", message: msg }); }
|
||||
function ok(x, msg) { results.push({ result: x ? "PASS" : "FAIL", message: msg }); }
|
||||
|
||||
let cpowLocation = Cu.getRealmLocation(obj);
|
||||
ok(/shared JSM global/.test(cpowLocation),
|
||||
|
@ -198,25 +191,22 @@ function compartment_test(finish)
|
|||
return results;
|
||||
}
|
||||
sendRpcMessage("cpows:compartment_test", {}, { getUnprivilegedObject: sb.getUnprivilegedObject,
|
||||
testParentObject: testParentObject });
|
||||
testParentObject });
|
||||
finish();
|
||||
}
|
||||
|
||||
function regexp_test(finish)
|
||||
{
|
||||
function regexp_test(finish) {
|
||||
sendRpcMessage("cpows:regexp_test", {}, { regexp: /myRegExp/g });
|
||||
finish();
|
||||
}
|
||||
|
||||
function postmessage_test(finish)
|
||||
{
|
||||
function postmessage_test(finish) {
|
||||
sendRpcMessage("cpows:postmessage_test", {}, { win: content.window });
|
||||
finish();
|
||||
}
|
||||
|
||||
function sync_test(finish)
|
||||
{
|
||||
dump('beginning cpow sync test\n');
|
||||
function sync_test(finish) {
|
||||
dump("beginning cpow sync test\n");
|
||||
sync_obj = make_object();
|
||||
sendRpcMessage("cpows:sync",
|
||||
make_json(),
|
||||
|
@ -224,9 +214,8 @@ function sync_test(finish)
|
|||
finish();
|
||||
}
|
||||
|
||||
function async_test(finish)
|
||||
{
|
||||
dump('beginning cpow async test\n');
|
||||
function async_test(finish) {
|
||||
dump("beginning cpow async test\n");
|
||||
async_obj = make_object();
|
||||
sendAsyncMessage("cpows:async",
|
||||
make_json(),
|
||||
|
@ -237,22 +226,20 @@ function async_test(finish)
|
|||
|
||||
var rpc_obj;
|
||||
|
||||
function rpc_test(finish)
|
||||
{
|
||||
dump('beginning cpow rpc test\n');
|
||||
function rpc_test(finish) {
|
||||
dump("beginning cpow rpc test\n");
|
||||
rpc_obj = make_object();
|
||||
rpc_obj.data.reenter = function () {
|
||||
rpc_obj.data.reenter = function() {
|
||||
sendRpcMessage("cpows:reenter", { }, { data: { valid: true } });
|
||||
return "ok";
|
||||
}
|
||||
};
|
||||
sendRpcMessage("cpows:rpc",
|
||||
make_json(),
|
||||
rpc_obj);
|
||||
finish();
|
||||
}
|
||||
|
||||
function lifetime_test(finish)
|
||||
{
|
||||
function lifetime_test(finish) {
|
||||
if (!is_remote) {
|
||||
// Only run this test when running out-of-process. Otherwise it
|
||||
// will fail, since local CPOWs don't follow the same ownership
|
||||
|
@ -263,7 +250,7 @@ function lifetime_test(finish)
|
|||
|
||||
dump("beginning lifetime test\n");
|
||||
var obj = {"will_die": {"f": 1}};
|
||||
let [result] = sendRpcMessage("cpows:lifetime_test_1", {}, {obj: obj});
|
||||
let [result] = sendRpcMessage("cpows:lifetime_test_1", {}, {obj});
|
||||
ok(result == 10, "got sync result");
|
||||
ok(obj.wont_die.f == undefined, "got reverse CPOW");
|
||||
obj.will_die = null;
|
||||
|
@ -276,8 +263,7 @@ function lifetime_test(finish)
|
|||
});
|
||||
}
|
||||
|
||||
function cancel_test(finish)
|
||||
{
|
||||
function cancel_test(finish) {
|
||||
if (!is_remote) {
|
||||
// No point in doing this in single-process mode.
|
||||
finish();
|
||||
|
@ -296,15 +282,14 @@ function cancel_test(finish)
|
|||
if (fin1 && fin2) finish();
|
||||
}
|
||||
|
||||
sendAsyncMessage("cpows:cancel_test", null, {f: f});
|
||||
sendAsyncMessage("cpows:cancel_test", null, {f});
|
||||
addMessageListener("cpows:cancel_test_done", msg => {
|
||||
fin2 = true;
|
||||
if (fin1 && fin2) finish();
|
||||
});
|
||||
}
|
||||
|
||||
function cancel_test2(finish)
|
||||
{
|
||||
function cancel_test2(finish) {
|
||||
if (!is_remote) {
|
||||
// No point in doing this in single-process mode.
|
||||
finish();
|
||||
|
@ -337,15 +322,14 @@ function cancel_test2(finish)
|
|||
if (fin1 && fin2) finish();
|
||||
}
|
||||
|
||||
sendAsyncMessage("cpows:cancel_test2", null, {f: f});
|
||||
sendAsyncMessage("cpows:cancel_test2", null, {f});
|
||||
addMessageListener("cpows:cancel_test2_done", msg => {
|
||||
fin2 = true;
|
||||
if (fin1 && fin2) finish();
|
||||
});
|
||||
}
|
||||
|
||||
function unsafe_test(finish)
|
||||
{
|
||||
function unsafe_test(finish) {
|
||||
if (!is_remote) {
|
||||
// Only run this test when running out-of-process.
|
||||
finish();
|
||||
|
@ -361,8 +345,7 @@ function unsafe_test(finish)
|
|||
});
|
||||
}
|
||||
|
||||
function dead_test(finish)
|
||||
{
|
||||
function dead_test(finish) {
|
||||
if (!is_remote) {
|
||||
// Only run this test when running out-of-process.
|
||||
finish();
|
||||
|
@ -372,7 +355,7 @@ function dead_test(finish)
|
|||
let gcTrigger = function() {
|
||||
// Force the GC to dead-ify the thing.
|
||||
content.windowUtils.garbageCollect();
|
||||
}
|
||||
};
|
||||
|
||||
{
|
||||
let thing = { value: "Gonna croak" };
|
||||
|
|
|
@ -7,7 +7,7 @@ class XFoo extends HTMLElement {
|
|||
connectedCallback() {
|
||||
finishTest(this.magicNumber === 42);
|
||||
}
|
||||
};
|
||||
}
|
||||
customElements.define("x-foo", XFoo);
|
||||
|
||||
document.firstChild.appendChild(document.createElement("x-foo"));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//# sourceMappingURL=bar.js.map
|
||||
// # sourceMappingURL=bar.js.map
|
||||
|
||||
// Define a single function to prevent script source from being gc'd
|
||||
function foo() {}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//# sourceMappingURL=bar.js.map
|
||||
// # sourceMappingURL=bar.js.map
|
||||
|
||||
// Define a single function to prevent script source from being gc'd
|
||||
function foo() {}
|
||||
|
|
|
@ -22,28 +22,28 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1339722
|
|||
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const TOPIC = 'http-on-useragent-request';
|
||||
const TOPIC = "http-on-useragent-request";
|
||||
Services.obs.addObserver({
|
||||
observe(subject, topic, data) {
|
||||
info('Got ' + topic);
|
||||
info("Got " + topic);
|
||||
Services.obs.removeObserver(this, TOPIC);
|
||||
|
||||
// Query window proxy so it triggers DOMWindowCreated.
|
||||
let channel = subject.QueryInterface(Ci.nsIHttpChannel);
|
||||
let win = channel.notificationCallbacks.getInterface(Ci.mozIDOMWindowProxy);
|
||||
}
|
||||
},
|
||||
}, TOPIC);
|
||||
|
||||
let docShell = SpecialPowers.wrap(window).docShell;
|
||||
docShell.chromeEventHandler.addEventListener('DOMWindowCreated', function handler(e) {
|
||||
docShell.chromeEventHandler.removeEventListener('DOMWindowCreated', handler);
|
||||
let iframe = document.getElementById('testFrame');
|
||||
is(e.target, iframe.contentDocument, 'verify event target');
|
||||
docShell.chromeEventHandler.addEventListener("DOMWindowCreated", function handler(e) {
|
||||
docShell.chromeEventHandler.removeEventListener("DOMWindowCreated", handler);
|
||||
let iframe = document.getElementById("testFrame");
|
||||
is(e.target, iframe.contentDocument, "verify event target");
|
||||
|
||||
// Remove the iframe to cause frameloader destroy.
|
||||
iframe.remove();
|
||||
setTimeout($ => {
|
||||
ok(!document.getElementById('testFrame'), 'verify iframe removed');
|
||||
ok(!document.getElementById("testFrame"), "verify iframe removed");
|
||||
SimpleTest.finish();
|
||||
}, 0);
|
||||
});
|
||||
|
|
|
@ -28,26 +28,26 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1346936
|
|||
ChromeUtils.import("resource://gre/modules/jsdebugger.jsm");
|
||||
addDebuggerToGlobal(this);
|
||||
|
||||
window.onload = function () {
|
||||
window.onload = function() {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.src = "http://mochi.test:8888/tests/dom/base/test/chrome/nochrome_bug1346936.html";
|
||||
iframe.onload = function () {
|
||||
iframe.onload = function() {
|
||||
var script = iframe.contentWindow.document.createElement("script");
|
||||
script.src = "http://mochi.test:8888/tests/dom/base/test/chrome/nochrome_bug1346936.js";
|
||||
script.onload = function () {
|
||||
script.onload = function() {
|
||||
var dbg = new Debugger(iframe.contentWindow);
|
||||
ok(dbg, "Should be able to create debugger");
|
||||
|
||||
var scripts = dbg.findScripts({
|
||||
url: "http://mochi.test:8888/tests/dom/base/test/chrome/nochrome_bug1346936.js"
|
||||
url: "http://mochi.test:8888/tests/dom/base/test/chrome/nochrome_bug1346936.js",
|
||||
});
|
||||
ok(scripts.length > 0, "Should be able to find script");
|
||||
|
||||
is(scripts[0].source.sourceMapURL, "foo.js.map");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
};
|
||||
|
||||
iframe.contentWindow.document.body.appendChild(script);
|
||||
};
|
||||
|
|
|
@ -22,7 +22,7 @@ SimpleTest.waitForExplicitFinish();
|
|||
|
||||
/*
|
||||
* Register a custom nsIProtocolHandler service
|
||||
* in order to be able to implement *and use* an
|
||||
* in order to be able to implement *and use* an
|
||||
* nsIChannel component written in Javascript.
|
||||
*/
|
||||
|
||||
|
@ -53,47 +53,47 @@ CustomChannel.prototype = {
|
|||
loadGroup: null,
|
||||
name: null,
|
||||
status: Cr.NS_OK,
|
||||
asyncOpen: function(listener, context) {
|
||||
asyncOpen(listener, context) {
|
||||
let stream = this.open();
|
||||
try {
|
||||
listener.onStartRequest(this, context);
|
||||
} catch(e) {}
|
||||
} catch (e) {}
|
||||
try {
|
||||
listener.onDataAvailable(this, context, stream, 0, stream.available());
|
||||
} catch(e) {}
|
||||
} catch (e) {}
|
||||
try {
|
||||
listener.onStopRequest(this, context, Cr.NS_OK);
|
||||
} catch(e) {}
|
||||
} catch (e) {}
|
||||
},
|
||||
asyncOpen2: function(listener) {
|
||||
asyncOpen2(listener) {
|
||||
// throws an error if security checks fail
|
||||
var outListener = contentSecManager.performSecurityCheck(this, listener);
|
||||
return this.asyncOpen(outListener, null);
|
||||
},
|
||||
open: function() {
|
||||
open() {
|
||||
let data = "bar";
|
||||
let stream = Cc["@mozilla.org/io/string-input-stream;1"].createInstance(Ci.nsIStringInputStream);
|
||||
stream.setData(data, data.length);
|
||||
return stream;
|
||||
},
|
||||
open2: function() {
|
||||
open2() {
|
||||
// throws an error if security checks fail
|
||||
contentSecManager.performSecurityCheck(this, null);
|
||||
return this.open();
|
||||
},
|
||||
isPending: function() {
|
||||
isPending() {
|
||||
return false;
|
||||
},
|
||||
cancel: function() {
|
||||
cancel() {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
suspend: function() {
|
||||
suspend() {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
resume: function() {
|
||||
resume() {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIChannel, Ci.nsIRequest])
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIChannel, Ci.nsIRequest]),
|
||||
};
|
||||
|
||||
|
||||
|
@ -125,11 +125,11 @@ CustomProtocol.prototype = {
|
|||
newChannel: function newChannel(URI) {
|
||||
return newChannel2(URI);
|
||||
},
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIProtocolHandler])
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIProtocolHandler]),
|
||||
};
|
||||
|
||||
var gFactory = {
|
||||
register: function() {
|
||||
register() {
|
||||
var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
|
||||
var classID = Components.ID("{ed064287-1e76-49ba-a28d-dc74394a8334}");
|
||||
|
@ -143,7 +143,7 @@ var gFactory = {
|
|||
registrar.unregisterFactory(classID, factory);
|
||||
delete this.unregister;
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
// Register the custom procotol handler
|
||||
|
@ -152,14 +152,14 @@ gFactory.register();
|
|||
// Then, checks if XHR works with it
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", PROTOCOL_SCHEME + ":foo", true);
|
||||
xhr.onload = function () {
|
||||
xhr.onload = function() {
|
||||
is(xhr.responseText, "bar", "protocol doesn't work");
|
||||
gFactory.unregister();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
};
|
||||
try {
|
||||
xhr.send(null);
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
ok(false, e);
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -28,26 +28,26 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=765993
|
|||
ChromeUtils.import("resource://gre/modules/jsdebugger.jsm");
|
||||
addDebuggerToGlobal(this);
|
||||
|
||||
window.onload = function () {
|
||||
window.onload = function() {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.src = "http://mochi.test:8888/tests/dom/base/test/chrome/nochrome_bug765993.html";
|
||||
iframe.onload = function () {
|
||||
iframe.onload = function() {
|
||||
var script = iframe.contentWindow.document.createElement("script");
|
||||
script.src = "http://mochi.test:8888/tests/dom/base/test/chrome/nochrome_bug765993.js";
|
||||
script.onload = function () {
|
||||
script.onload = function() {
|
||||
var dbg = new Debugger(iframe.contentWindow);
|
||||
ok(dbg, "Should be able to create debugger");
|
||||
|
||||
var scripts = dbg.findScripts({
|
||||
url: "http://mochi.test:8888/tests/dom/base/test/chrome/nochrome_bug765993.js"
|
||||
url: "http://mochi.test:8888/tests/dom/base/test/chrome/nochrome_bug765993.js",
|
||||
});
|
||||
ok(scripts.length > 0, "Should be able to find script");
|
||||
|
||||
is(scripts[0].source.sourceMapURL, "foo.js.map");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
};
|
||||
|
||||
iframe.contentWindow.document.body.appendChild(script);
|
||||
};
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
</style>
|
||||
|
||||
<script>
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
|
@ -58,18 +58,18 @@ function runTests() {
|
|||
// Targets are provided in order we expect them to appear.
|
||||
// Has to end in a non-todo element in order for testing logic to work.
|
||||
let targetsFromRoot = [
|
||||
{id:"root", message:"root with display:grid"},
|
||||
{id:"a", message:"'plain' grid container with display:grid"},
|
||||
{id:"b", message:"display:subgrid inside display:grid (to be fixed in Bug 1240834)", todo:true},
|
||||
{id:"c", message:"'plain' grid container with display:inline-grid"},
|
||||
{id:"d", message:"display:subgrid inside display:inline-grid (to be fixed in Bug 1240834)", todo:true},
|
||||
{id:"e", message:"grid container with visibility:hidden"},
|
||||
{id:"f", message:"grid container inside an element"},
|
||||
{id:"g", message:"overflow:scroll grid container"},
|
||||
{id:"h", message:"button as a grid container"},
|
||||
{id:"i", message:"fieldset as a grid container"},
|
||||
{id:"k1", message:"grid container containing a grid container"},
|
||||
{id:"k2", message:"grid container inside a grid container"},
|
||||
{id: "root", message: "root with display:grid"},
|
||||
{id: "a", message: "'plain' grid container with display:grid"},
|
||||
{id: "b", message: "display:subgrid inside display:grid (to be fixed in Bug 1240834)", todo: true},
|
||||
{id: "c", message: "'plain' grid container with display:inline-grid"},
|
||||
{id: "d", message: "display:subgrid inside display:inline-grid (to be fixed in Bug 1240834)", todo: true},
|
||||
{id: "e", message: "grid container with visibility:hidden"},
|
||||
{id: "f", message: "grid container inside an element"},
|
||||
{id: "g", message: "overflow:scroll grid container"},
|
||||
{id: "h", message: "button as a grid container"},
|
||||
{id: "i", message: "fieldset as a grid container"},
|
||||
{id: "k1", message: "grid container containing a grid container"},
|
||||
{id: "k2", message: "grid container inside a grid container"},
|
||||
];
|
||||
is(elementsFromRoot.length, 10, "Found expected number of elements within document root.");
|
||||
testTargetsAreInElements(targetsFromRoot, elementsFromRoot);
|
||||
|
@ -79,7 +79,7 @@ function runTests() {
|
|||
let elementsFromNonRoot = document.getElementById("a_non_root_element").getElementsWithGrid();
|
||||
|
||||
let targetsFromNonRoot = [
|
||||
{id:"f", message:"grid container inside an element (from non-root element)"},
|
||||
{id: "f", message: "grid container inside an element (from non-root element)"},
|
||||
];
|
||||
is(elementsFromNonRoot.length, 1, "Found expected number of elements from non-root element.");
|
||||
testTargetsAreInElements(targetsFromNonRoot, elementsFromNonRoot);
|
||||
|
|
|
@ -4,28 +4,27 @@
|
|||
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
<script>
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function runTests()
|
||||
{
|
||||
function runTests() {
|
||||
let range = document.createRange();
|
||||
|
||||
let attempts = [
|
||||
{startNode: "one", start:0, endNode:"one", end:0, textList:[], message:"Empty rect"},
|
||||
{startNode: "one", start:2, endNode:"one", end:6, textList:["l on"], message:"Single line"},
|
||||
{startNode: "implicit", start:6, endNode:"implicit", end:12, textList:["it bre"], message:"Implicit break"},
|
||||
{startNode: "two.a", start:1, endNode:"two.b", end:2, textList:["wo", "", "li"], message:"Two lines"},
|
||||
{startNode: "embed.a", start:7, endNode:"embed.b", end:2, textList:["th ", "simple nested", " ", "te"], message:"Simple nested"},
|
||||
{startNode: "deep.a", start:2, endNode:"deep.b", end:2, textList:["ne with ", "complex, more deeply nested", " ", "te"], message:"Complex nested"},
|
||||
{startNode: "image.a", start:7, endNode:"image.b", end:2, textList:["th inline ", "", " ", "im"], message:"Inline image"},
|
||||
{startNode: "hyphen1", start:0, endNode:"hyphen1", end:3, textList:["a\u00AD", "b"], message:"Shy hyphen (active)"},
|
||||
{startNode: "hyphen2", start:0, endNode:"hyphen2", end:3, textList:["c\u00ADd"], message:"Shy hyphen (inactive)"},
|
||||
{startNode: "hyphen2", start:0, endNode:"hyphen2", end:2, textList:["c\u00AD"], message:"Shy hyphen (inactive, trailing)"},
|
||||
{startNode: "hyphen2", start:1, endNode:"hyphen2", end:3, textList:["\u00ADd"], message:"Shy hyphen (inactive, leading)"},
|
||||
{startNode: "uc", start:0, endNode:"uc", end:2, textList:["EF"], message:"UC transform"},
|
||||
{startNode: "pre", start:0, endNode:"pre", end:3, textList:["g\n", "h"], message:"pre with break"},
|
||||
{startNode: "one", start: 0, endNode: "one", end: 0, textList: [], message: "Empty rect"},
|
||||
{startNode: "one", start: 2, endNode: "one", end: 6, textList: ["l on"], message: "Single line"},
|
||||
{startNode: "implicit", start: 6, endNode: "implicit", end: 12, textList: ["it bre"], message: "Implicit break"},
|
||||
{startNode: "two.a", start: 1, endNode: "two.b", end: 2, textList: ["wo", "", "li"], message: "Two lines"},
|
||||
{startNode: "embed.a", start: 7, endNode: "embed.b", end: 2, textList: ["th ", "simple nested", " ", "te"], message: "Simple nested"},
|
||||
{startNode: "deep.a", start: 2, endNode: "deep.b", end: 2, textList: ["ne with ", "complex, more deeply nested", " ", "te"], message: "Complex nested"},
|
||||
{startNode: "image.a", start: 7, endNode: "image.b", end: 2, textList: ["th inline ", "", " ", "im"], message: "Inline image"},
|
||||
{startNode: "hyphen1", start: 0, endNode: "hyphen1", end: 3, textList: ["a\u00AD", "b"], message: "Shy hyphen (active)"},
|
||||
{startNode: "hyphen2", start: 0, endNode: "hyphen2", end: 3, textList: ["c\u00ADd"], message: "Shy hyphen (inactive)"},
|
||||
{startNode: "hyphen2", start: 0, endNode: "hyphen2", end: 2, textList: ["c\u00AD"], message: "Shy hyphen (inactive, trailing)"},
|
||||
{startNode: "hyphen2", start: 1, endNode: "hyphen2", end: 3, textList: ["\u00ADd"], message: "Shy hyphen (inactive, leading)"},
|
||||
{startNode: "uc", start: 0, endNode: "uc", end: 2, textList: ["EF"], message: "UC transform"},
|
||||
{startNode: "pre", start: 0, endNode: "pre", end: 3, textList: ["g\n", "h"], message: "pre with break"},
|
||||
];
|
||||
|
||||
for (let attempt of attempts) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче