mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-11 05:39:41 +02:00
MozReview-Commit-ID: 7EKrQudqd4D --HG-- rename : testing/web-platform/tests/app-uri/resources/ExamPLE/mmY/index.html => testing/web-platform/tests/XMLHttpRequest/resources/pass.txt rename : testing/web-platform/tests/css/css-ui-3/support/nav-dir-target-001-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-dir-target-001-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-dir-target-002-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-dir-target-002-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-dir-target-003-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-dir-target-003-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-dir-target-004-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-dir-target-004-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-dir-target-005-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-dir-target-005-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-down-009-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-down-009-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-down-010-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-down-010-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-down-011-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-down-011-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-down-012-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-down-012-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-down-013-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-down-013-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-left-009-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-left-009-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-left-010-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-left-010-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-left-011-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-left-011-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-left-012-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-left-012-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-left-013-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-left-013-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-right-009-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-right-009-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-right-010-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-right-010-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-right-011-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-right-011-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-right-012-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-right-012-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-right-013-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-right-013-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-up-009-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-up-009-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-up-010-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-up-010-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-up-011-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-up-011-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-up-012-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-up-012-frame.html rename : testing/web-platform/tests/css/css-ui-3/support/nav-up-013-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-up-013-frame.html rename : testing/web-platform/tests/fullscreen/api/element-ready-check-enabled-flag-not-set-manual.html => testing/web-platform/tests/fullscreen/api/element-ready-check-not-allowed-manual.html rename : testing/web-platform/tests/html/user-interaction/focus/tabindex-focus-flag.html => testing/web-platform/tests/html/editing/focus/tabindex-focus-flag.html rename : testing/web-platform/tests/image-decodes/image-decode-iframe.html => testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode-iframe.html rename : testing/web-platform/tests/image-decodes/image-decode-path-changes.html => testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode-path-changes.html rename : testing/web-platform/tests/image-decodes/image-decode.html => testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode.html
100 lines
3.4 KiB
JavaScript
100 lines
3.4 KiB
JavaScript
var SRIScriptTest = function(pass, name, src, integrityValue, crossoriginValue, nonce) {
|
|
this.pass = pass;
|
|
this.name = "Script: " + name;
|
|
this.src = src;
|
|
this.integrityValue = integrityValue;
|
|
this.crossoriginValue = crossoriginValue;
|
|
this.nonce = nonce;
|
|
}
|
|
|
|
SRIScriptTest.prototype.execute = function() {
|
|
var test = async_test(this.name);
|
|
var e = document.createElement("script");
|
|
e.src = this.src;
|
|
e.setAttribute("integrity", this.integrityValue);
|
|
if(this.crossoriginValue) {
|
|
e.setAttribute("crossorigin", this.crossoriginValue);
|
|
}
|
|
if(this.nonce) {
|
|
e.setAttribute("nonce", this.nonce);
|
|
}
|
|
if(this.pass) {
|
|
e.addEventListener("load", function() {test.done()});
|
|
e.addEventListener("error", function() {
|
|
test.step(function(){ assert_unreached("Good load fired error handler.") })
|
|
});
|
|
} else {
|
|
e.addEventListener("load", function() {
|
|
test.step(function() { assert_unreached("Bad load succeeded.") })
|
|
});
|
|
e.addEventListener("error", function() {test.done()});
|
|
}
|
|
document.body.appendChild(e);
|
|
};
|
|
|
|
// <link> tests
|
|
// Style tests must be done synchronously because they rely on the presence
|
|
// and absence of global style, which can affect later tests. Thus, instead
|
|
// of executing them one at a time, the style tests are implemented as a
|
|
// queue that builds up a list of tests, and then executes them one at a
|
|
// time.
|
|
var SRIStyleTest = function(queue, pass, name, attrs, customCallback, altPassValue) {
|
|
this.pass = pass;
|
|
this.name = "Style: " + name;
|
|
this.customCallback = customCallback || function () {};
|
|
this.attrs = attrs || {};
|
|
this.passValue = altPassValue || "rgb(255, 255, 0)";
|
|
|
|
this.test = async_test(this.name);
|
|
|
|
this.queue = queue;
|
|
this.queue.push(this);
|
|
}
|
|
|
|
SRIStyleTest.prototype.execute = function() {
|
|
var that = this;
|
|
var container = document.getElementById("container");
|
|
while (container.hasChildNodes()) {
|
|
container.removeChild(container.firstChild);
|
|
}
|
|
|
|
var test = this.test;
|
|
|
|
var div = document.createElement("div");
|
|
div.className = "testdiv";
|
|
var e = document.createElement("link");
|
|
this.attrs.rel = this.attrs.rel || "stylesheet";
|
|
for (var key in this.attrs) {
|
|
if (this.attrs.hasOwnProperty(key)) {
|
|
e.setAttribute(key, this.attrs[key]);
|
|
}
|
|
}
|
|
|
|
if(this.pass) {
|
|
e.addEventListener("load", function() {
|
|
test.step(function() {
|
|
var background = window.getComputedStyle(div, null).getPropertyValue("background-color");
|
|
assert_equals(background, that.passValue);
|
|
test.done();
|
|
});
|
|
});
|
|
e.addEventListener("error", function() {
|
|
test.step(function(){ assert_unreached("Good load fired error handler.") })
|
|
});
|
|
} else {
|
|
e.addEventListener("load", function() {
|
|
test.step(function() { assert_unreached("Bad load succeeded.") })
|
|
});
|
|
e.addEventListener("error", function() {
|
|
test.step(function() {
|
|
var background = window.getComputedStyle(div, null).getPropertyValue("background-color");
|
|
assert_not_equals(background, that.passValue);
|
|
test.done();
|
|
});
|
|
});
|
|
}
|
|
container.appendChild(div);
|
|
container.appendChild(e);
|
|
this.customCallback(e, container);
|
|
};
|
|
|