Bug 800864 - Add some more tests. r=bz
authorBobby Holley <bobbyholley@gmail.com>
Mon, 05 Nov 2012 17:15:53 -0800
changeset 112370 38a111dc16e21b822c7a678a4b2b55f433d82611
parent 112369 801d11096998395738377ce13beb394d4c102c78
child 112371 60c4b0129f99426fee5c15774ade54e6fae60b4b
push id23812
push useremorley@mozilla.com
push dateTue, 06 Nov 2012 14:01:34 +0000
treeherdermozilla-central@f4aeed115e54 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs800864
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 800864 - Add some more tests. r=bz
js/xpconnect/tests/mochitest/Makefile.in
js/xpconnect/tests/mochitest/test_bug800864.html
--- a/js/xpconnect/tests/mochitest/Makefile.in
+++ b/js/xpconnect/tests/mochitest/Makefile.in
@@ -79,16 +79,17 @@ MOCHITEST_FILES =	chrome_wrappers_helper
 		test_bug781476.html \
 		file_bug781476.html \
 		test_bug785096.html \
 		test_bug789713.html \
 		test_bug793969.html \
 		file_bug795275.html \
 		file_bug795275.xml \
 		file_bug799348.html \
+		test_bug800864.html \
 		$(NULL)
 
 ifneq ($(OS_TARGET),Android)
 ifndef MOZ_PLATFORM_MAEMO
 MOCHITEST_FILES +=	test_bug564330.html \
 		test_bug618017.html
 endif
 endif
new file mode 100644
--- /dev/null
+++ b/js/xpconnect/tests/mochitest/test_bug800864.html
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=800864
+-->
+<head>
+  <title>Test for Bug 800864</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=800864">Mozilla Bug 800864</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+  
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+function checkThrows(f) {
+  try {
+    f();
+    ok(false, "Didn't throw a security exception like we should");
+  } catch(e) {
+    ok(/denied/.exec(e), "Should throw |denied| exception. Got: " + e);
+  }
+}
+
+function go() {
+  ifr = document.getElementById('ifr');
+  win = ifr.contentWindow;
+  loc = win.location;
+  ifr.onload = check;
+  win.location = 'http://test1.example.com';
+}
+
+function check() {
+  checkThrows(function() { loc.toString(); });
+  checkThrows(function() { loc.valueOf(); });
+  checkThrows(function() { loc + ''; });
+  SimpleTest.finish();
+}
+
+</script>
+</pre>
+</body>
+<iframe id="ifr" onload="go()" src="file_empty.html"></iframe>
+</html>