summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webidl/ecmascript-binding/observable-array-no-leak-of-internals.window.js
blob: f93464005d017f6af716bdf66b85834be13012ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"use strict";

test(() => {
  const observableArray = document.adoptedStyleSheets;

  let leaked_target = null;
  let leaked_handler = null;

  let target_leaker = (target) => { leaked_target = target; return null; };
  Object.defineProperty(Object.prototype, "getPrototypeOf", {get: function() {
    leaked_handler = this;
    return target_leaker;
  }})
  Object.getPrototypeOf(observableArray);

  assert_equals(leaked_target, null, "The proxy target leaked.");
  assert_equals(leaked_handler, null, "The proxy handler leaked.");
}, "ObservableArray's internals won't leak");