Browse Source

use window.location instead of location

Zeke Sikelianos 9 years ago
parent
commit
47a61e9f27
3 changed files with 5 additions and 5 deletions
  1. 2 2
      lib/renderer/chrome-api.js
  2. 2 2
      lib/renderer/init.js
  3. 1 1
      lib/renderer/override.js

+ 2 - 2
lib/renderer/chrome-api.js

@@ -4,9 +4,9 @@ const chrome = window.chrome = window.chrome || {}
 chrome.extension = {
   getURL: function (path) {
     return url.format({
-      protocol: location.protocol,
+      protocol: window.location.protocol,
       slashes: true,
-      hostname: location.hostname,
+      hostname: window.location.hostname,
       pathname: path
     })
   }

+ 2 - 2
lib/renderer/init.js

@@ -65,11 +65,11 @@ for (i = 0, len = ref.length; i < len; i++) {
   }
 }
 
-if (location.protocol === 'chrome-devtools:') {
+if (window.location.protocol === 'chrome-devtools:') {
   // Override some inspector APIs.
   require('./inspector')
   nodeIntegration = 'true'
-} else if (location.protocol === 'chrome-extension:') {
+} else if (window.location.protocol === 'chrome-extension:') {
   // Add implementations of chrome API.
   require('./chrome-api')
   nodeIntegration = 'true'

+ 1 - 1
lib/renderer/override.js

@@ -70,7 +70,7 @@ var BrowserWindowProxy = (function () {
     if (targetOrigin == null) {
       targetOrigin = '*'
     }
-    return ipcRenderer.send('ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_POSTMESSAGE', this.guestId, message, targetOrigin, location.origin)
+    return ipcRenderer.send('ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_POSTMESSAGE', this.guestId, message, targetOrigin, window.location.origin)
   }
 
   BrowserWindowProxy.prototype['eval'] = function (...args) {