forked from Floorp-Projects/Floorp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 827801 - Test that OS.Constants is not available to content. r=khuey
- Loading branch information
David Rajchenbach-Teller
committed
Jan 9, 2013
1 parent
d98f0be
commit 002e900
Showing
3 changed files
with
41 additions
and
1 deletion.
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
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,31 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<title>Testing that OS.Constants is not available from web content</title> | ||
<script src="/tests/SimpleTest/SimpleTest.js"></script> | ||
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/> | ||
<script type="application/javascript"> | ||
|
||
// 1. Test that OS is not available from the main thread | ||
SimpleTest.is(typeof OS, "undefined", "OS is not available from the main thread"); | ||
|
||
// 2. Test that OS is not available from a web worker | ||
SimpleTest.waitForExplicitFinish(); | ||
worker = new Worker("worker_notaccessiblefromcontent.js"); | ||
worker.onmessage = function onmessage(event) { | ||
SimpleTest.info("Received " + JSON.stringify(event.data)); | ||
SimpleTest.ok(event.data.result, "OS is not available from a web worker"); | ||
SimpleTest.finish(); | ||
} | ||
worker.onerror = function onerror(event) { | ||
SimpleTest.ok(false, "Error: " + event); | ||
SimpleTest.finish(); | ||
}; | ||
worker.postMessage(0); | ||
|
||
</script> | ||
</head> | ||
|
||
<body> | ||
</body> | ||
</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,6 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
self.onmessage = function onmessage() { | ||
self.postMessage({result: typeof OS == "undefined"}); | ||
}; |