浏览代码

Ignore about: and moz- URLs in a few places.

FelisCatus 8 年之前
父节点
当前提交
d65c29f34d

+ 6 - 2
omega-target-chromium-extension/background.coffee

@@ -288,8 +288,12 @@ encodeError = (obj) ->
 refreshActivePageIfEnabled = ->
   return if localStorage['omega.local.refreshOnProfileChange'] == 'false'
   chrome.tabs.query {active: true, lastFocusedWindow: true}, (tabs) ->
-    if tabs[0].url and tabs[0].url.substr(0, 6) != 'chrome'
-      chrome.tabs.reload(tabs[0].id, {bypassCache: true})
+    url = tabs[0].url
+    return if not url
+    return if url.substr(0, 6) == 'chrome'
+    return if url.substr(0, 6) == 'about:'
+    return if url.substr(0, 4) == 'moz-'
+    chrome.tabs.reload(tabs[0].id, {bypassCache: true})
 
 chrome.runtime.onMessage.addListener (request, sender, respond) ->
   options.ready.then ->

+ 2 - 1
omega-target-chromium-extension/omega_target_web.coffee

@@ -40,7 +40,8 @@ angular.module('omegaTarget', []).factory 'omegaTarget', ($q) ->
     port.onMessage.addListener(callback)
     return
 
-  isChromeUrl = (url) -> url.substr(0, 6) == 'chrome'
+  isChromeUrl = (url) -> url.substr(0, 6) == 'chrome' or
+    url.substr(0, 4) == 'moz-' or url.substr(0, 6) == 'about:'
 
   optionsChangeCallback = []
   requestInfoCallback = null

+ 8 - 2
omega-target-chromium-extension/src/options.coffee

@@ -201,8 +201,12 @@ class ChromeOptions extends OmegaTarget.Options
           index = (index + 1) % profiles.length
           @applyProfile(profiles[index]).then =>
             if @_options['-refreshOnProfileChange']
-              if tab.url and tab.url.indexOf('chrome') != 0
-                chrome.tabs.reload(tab.id)
+              url = tab.url
+              return if not url
+              return if url.substr(0, 6) == 'chrome'
+              return if url.substr(0, 6) == 'about:'
+              return if url.substr(0, 4) == 'moz-'
+              chrome.tabs.reload(tab.id)
     else
       chrome.browserAction.setPopup({popup: 'popup/index.html'})
     Promise.resolve()
@@ -356,6 +360,8 @@ class ChromeOptions extends OmegaTarget.Options
           return result if not url
         else
           return result
+      return result if url.substr(0, 6) == 'about:'
+      return result if url.substr(0, 4) == 'moz-'
       domain = OmegaPac.getBaseDomain(Url.parse(url).hostname)
 
       return {

+ 2 - 0
omega-target-chromium-extension/src/web_request_monitor.coffee

@@ -89,6 +89,8 @@ module.exports = class WebRequestMonitor
     return if req.error.indexOf('net::ERR_FILE_') == 0
     return if req.url.indexOf('file:') == 0
     return if req.url.indexOf('chrome') == 0
+    return if req.url.indexOf('about:') == 0
+    return if req.url.indexOf('moz-') == 0
     # Some ad-blocking extensions may redirect requests to 127.0.0.1.
     return if req.url.indexOf('://127.0.0.1') > 0
     return unless reqInfo