From: Cheng Zhao Date: Wed, 27 Aug 2014 13:05:54 +0000 (+0800) Subject: Ignore requests to other hosts. X-Git-Tag: v0.16.0~10^2~6 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=b6c2e7ef768c542308cd06ecaee56382134b205d;p=electron.git Ignore requests to other hosts. --- diff --git a/atom/browser/lib/chrome-extension.coffee b/atom/browser/lib/chrome-extension.coffee index 3a62da57..6ca1bc16 100644 --- a/atom/browser/lib/chrome-extension.coffee +++ b/atom/browser/lib/chrome-extension.coffee @@ -8,7 +8,7 @@ hostPathMap = {} hostPathMapNextKey = 0 getHostForPath = (path) -> - key = "extension-#{hostPathMapNextKey}" + key = "extension-#{++hostPathMapNextKey}" hostPathMap[key] = path key @@ -23,6 +23,8 @@ app.once 'ready', -> parsed = url.parse request.url return unless parsed.hostname and parsed.path? + return unless /extension-\d+/.test parsed.hostname + directory = getPathForHost parsed.hostname return new protocol.RequestFileJob(path.join(directory, parsed.path))