Assert built-in prototype isolation
authorKevin Sawicki <kevinsawicki@gmail.com>
Thu, 15 Dec 2016 23:23:45 +0000 (15:23 -0800)
committerKevin Sawicki <kevinsawicki@gmail.com>
Mon, 16 Jan 2017 20:38:16 +0000 (12:38 -0800)
spec/api-browser-window-spec.js
spec/fixtures/api/isolated-preload.js
spec/fixtures/api/isolated.html

index 6332406..39d262b 100644 (file)
@@ -1845,13 +1845,17 @@ describe('BrowserWindow module', function () {
             preloadProperty: 'number',
             pageProperty: 'undefined',
             typeofRequire: 'function',
-            typeofProcess: 'object'
+            typeofProcess: 'object',
+            typeofArrayPush: 'function',
+            typeofFunctionApply: 'function',
           },
           pageContext: {
             preloadProperty: 'undefined',
             pageProperty: 'string',
             typeofRequire: 'undefined',
-            typeofProcess: 'undefined'
+            typeofProcess: 'undefined',
+            typeofArrayPush: 'number',
+            typeofFunctionApply: 'boolean',
           }
         })
         done()
index 8cb80d3..c92be35 100644 (file)
@@ -8,7 +8,9 @@ window.addEventListener('message', (event) => {
       preloadProperty: typeof window.foo,
       pageProperty: typeof window.hello,
       typeofRequire: typeof require,
-      typeofProcess: typeof process
+      typeofProcess: typeof process,
+      typeofArrayPush: typeof Array.prototype.push,
+      typeofFunctionApply: typeof Function.prototype.apply
     },
     pageContext: event.data
   })
index bb0aca9..b2d2b4e 100644 (file)
@@ -5,11 +5,15 @@
     <title>Isolated World</title>
     <script>
       window.hello = 'world'
+      Array.prototype.push = 3
+      Function.prototype.apply = true
       window.postMessage({
         preloadProperty: typeof window.foo,
         pageProperty: typeof window.hello,
         typeofRequire: typeof require,
-        typeofProcess: typeof process
+        typeofProcess: typeof process,
+        typeofArrayPush: typeof Array.prototype.push,
+        typeofFunctionApply: typeof Function.prototype.apply
       }, '*')
     </script>
   </head>