summaryrefslogtreecommitdiffstats
path: root/js/xpconnect/tests/unit/test_xray_named_element_access.js
blob: 938d1575cabe018c6ef6ac8c5fe5892ca7341a76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1273251
"use strict"

ChromeUtils.import("resource://gre/modules/Preferences.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");

add_task(async function() {
  let webnav = Services.appShell.createWindowlessBrowser(false);

  let docShell = webnav.docShell;

  docShell.createAboutBlankContentViewer(null, null);

  let window = webnav.document.defaultView;
  let unwrapped = Cu.waiveXrays(window);

  window.document.body.innerHTML = '<div id="foo"></div>';

  equal(window.foo, undefined, "Should not have named X-ray property access");
  equal(typeof unwrapped.foo, "object", "Should always have non-X-ray named property access");

  webnav.close();
});