Skip to content

Commit

Permalink
Bug 863246 - Add test cases r=billm
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: 9oXWNOREemX

--HG--
extra : rebase_source : 2d13e3b9fc48d1a8060992bc99d846cca8342480
  • Loading branch information
Chung-Sheng Fu authored and Alex Kontos committed Apr 30, 2018
1 parent 321ed22 commit e969c19
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[DEFAULT]
tags = resistfingerprinting

support-files =
worker_child.js
worker_grandchild.js
Expand All @@ -12,3 +13,5 @@ scheme = https
[test_hide_gamepad_info.html]
support-files = test_hide_gamepad_info_iframe.html
[test_speech_synthesis.html]
[test_bug1382499_touch_api.html]
[test_bug863246_resource_uri.html]
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!DOCTYPE html>
<meta charset="utf8">
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/SpawnTask.js"></script>
<script>
/* global SimpleTest SpecialPowers add_task */

function waitForDOMContentLoaded() {
return new Promise((aResolve) => {
document.addEventListener("DOMContentLoaded", aResolve);
});
}

function testResourceUri(aTest, aUri, aContentAccessible) {
return new Promise((aResolve) => {
let link = document.createElement("link");
link.rel = "stylesheet";
link.onload = () => {
SimpleTest.ok(aContentAccessible, aTest);
aResolve();
};
link.onerror = () => {
SimpleTest.ok(!aContentAccessible, aTest);
aResolve();
};
link.href = aUri;
document.head.appendChild(link);
});
}

add_task(async function() {
await waitForDOMContentLoaded();
await testResourceUri(
"resource://content-accessible is content-accessible",
"resource://content-accessible/viewsource.css",
true);
await testResourceUri(
"resource://gre-resources is not content-accessible",
"resource://gre-resources/html.css",
false);
await SpecialPowers.pushPrefEnv({
set: [
["security.all_resource_uri_content_accessible", true]
]
});
await testResourceUri(
"security.all_resource_uri_content_accessible = true, resource://gre-resources is now content-accessible",
"resource://gre-resources/html.css",
true);
});
</script>

0 comments on commit e969c19

Please sign in to comment.