Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / toolkit / components / viewsource / test / test_428653.xul
blob34816a40aad4640933811b33ec6b742ee0781586
1 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> 
2 <?xml-stylesheet
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>
13    
14   <html:body/>
16   <browser id="content" type="content-primary" name="content" src="about:blank" flex="1"
17            disablehistory="true" context="viewSourceContextMenu"/>
19   <script type="application/javascript">
20   <![CDATA[
21   /*
22   Test that we can't call the content browser's document.open() either via
23   wrappedJSObject (SafeJSObjectWrapper) or not.
24   */
25   SimpleTest.waitForExplicitFinish();
26   
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");
33     var opened = false;
34     try {
35       doc.open("text/html", "replace");
36       opened = true;
37     } catch (e) {
38       is(e.name, "NS_ERROR_DOM_SECURITY_ERR", "Unxpected exception")
39     }
40     is(opened, false, "Shouldn't have opened document");
42     try {
43       doc.wrappedJSObject.open("text/html", "replace");
44       opened = true;
45     } catch (e) {
46       is(e.name, "NS_ERROR_DOM_SECURITY_ERR",
47          "Unxpected exception via wrappedJSObject")
48     }
49     is(opened, false, "Shouldn't have opened document via wrappedJSObject");
51     SimpleTest.finish();
52   });
53   ]]>
54   </script>
55 </window>