-
-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
browser/components/resistfingerprinting/test/mochitest/test_bug863246_resource_uri.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |