1 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
3 href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
5 <window title="View Source Test (bug 428653)"
6 xmlns:html="http://www.w3.org/1999/xhtml"
7 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
9 <script type="application/javascript"
10 src="chrome://mochikit/content/MochiKit/packed.js"></script>
11 <script type="application/javascript"
12 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
16 <browser id="content" type="content-primary" name="content" src="about:blank" flex="1"
17 disablehistory="true" context="viewSourceContextMenu"/>
19 <script type="application/javascript">
22 Test that we can't call the content browser's document.open() either via
23 wrappedJSObject (SafeJSObjectWrapper) or not.
25 SimpleTest.waitForExplicitFinish();
27 addLoadEvent(function testDocumentOpen() {
28 var browser = document.getElementById("content");
29 ok(browser, "got browser");
30 var doc = browser.contentDocument;
31 ok(doc, "got content document");
35 doc.open("text/html", "replace");
38 is(e.name, "NS_ERROR_DOM_SECURITY_ERR", "Unxpected exception")
40 is(opened, false, "Shouldn't have opened document");
43 doc.wrappedJSObject.open("text/html", "replace");
46 is(e.name, "NS_ERROR_DOM_SECURITY_ERR",
47 "Unxpected exception via wrappedJSObject")
49 is(opened, false, "Shouldn't have opened document via wrappedJSObject");