1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.htmlunit.javascript.host;
16
17 import org.htmlunit.WebDriverTestCase;
18 import org.htmlunit.junit.BrowserRunner;
19 import org.htmlunit.junit.annotation.Alerts;
20 import org.htmlunit.junit.annotation.HtmlUnitNYI;
21 import org.junit.Test;
22 import org.junit.runner.RunWith;
23
24
25
26
27
28
29
30
31 @RunWith(BrowserRunner.class)
32 public class NetscapeTest extends WebDriverTestCase {
33
34
35
36
37 @Test
38 @Alerts(DEFAULT = {"undefined", "undefined", "TypeError"},
39 FF = {"[object Object]", "undefined", "[object Object]", "undefined"},
40 FF_ESR = {"[object Object]", "undefined", "[object Object]", "undefined"})
41 public void netscape() throws Exception {
42 final String html = DOCTYPE_HTML
43 + "<html><body>\n"
44 + "<script>\n"
45 + LOG_TITLE_FUNCTION
46 + "try {\n"
47 + " log(window.netscape);\n"
48 + " log(window.Netscape);\n"
49 + " log(window.netscape.security);\n"
50 + " log(window.netscape.security.PrivilegeManager);\n"
51 + "} catch(e) { logEx(e); }\n"
52 + "</script></body></html>";
53
54 loadPageVerifyTitle2(html);
55 }
56
57
58
59
60
61 @Test
62 @Alerts(DEFAULT = "TypeError",
63 FF = {"true", "false", "true"},
64 FF_ESR = {"true", "false", "true"})
65 @HtmlUnitNYI(FF = {"undefined", "true", "true"},
66 FF_ESR = {"undefined", "true", "true"})
67 public void netscapeDescriptor() throws Exception {
68 final String html = DOCTYPE_HTML
69 + "<html><body>\n"
70 + "<script>\n"
71 + LOG_TITLE_FUNCTION
72 + "try {\n"
73 + " var d1 = Object.getOwnPropertyDescriptor(window, 'netscape');\n"
74 + " log(d1.writable);\n"
75 + " log(d1.enumerable);\n"
76 + " log(d1.configurable);\n"
77 + "} catch(e) { logEx(e); }\n"
78 + "</script></body></html>";
79
80 loadPageVerifyTitle2(html);
81 }
82 }