Browse Source

fix: do not expose Node's external strings (#13438)

Cheng Zhao 6 years ago
parent
commit
44aad039c6
3 changed files with 11 additions and 1 deletions
  1. 9 0
      spec/chromium-spec.js
  2. 1 0
      spec/fixtures/pages/external-string.html
  3. 1 1
      vendor/node

+ 9 - 0
spec/chromium-spec.js

@@ -70,6 +70,15 @@ describe('chromium feature', () => {
     })
   })
 
+  describe('accessing key names also used as Node.js module names', () => {
+    it('does not crash', (done) => {
+      w = new BrowserWindow({show: false})
+      w.webContents.once('did-finish-load', () => { done() })
+      w.webContents.once('crashed', () => done(new Error('WebContents crashed.')))
+      w.loadURL(`file://${fixtures}/pages/external-string.html`)
+    })
+  })
+
   describe('navigator.webkitGetUserMedia', () => {
     it('calls its callbacks', (done) => {
       navigator.webkitGetUserMedia({

+ 1 - 0
spec/fixtures/pages/external-string.html

@@ -0,0 +1 @@
+<script>window.stream</script>

+ 1 - 1
vendor/node

@@ -1 +1 @@
-Subproject commit 18aeda2077e7fe1ef9d7557692dda2e4d6a61860
+Subproject commit e61694e449e62e36dfe243d266e6313a0a043d5c