summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/service-workers/service-worker/resources/immutable-prototype-serviceworker.js
blob: d8a94ad46befb085791d13f21e6870e09284abe0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function prototypeChain(global) {
  let result = [];
  while (global !== null) {
    let thrown = false;
    let next = Object.getPrototypeOf(global);
    try {
      Object.setPrototypeOf(global, {});
      result.push('mutable');
    } catch (e) {
      result.push('immutable');
    }
    global = next;
  }
  return result;
}

self.onmessage = function(e) {
  e.data.postMessage(prototypeChain(self));
};