diff --git a/background.js b/background.js index f6f2b03..9373cfa 100644 --- a/background.js +++ b/background.js @@ -635,6 +635,7 @@ function handleRedirect(details) { if(searchContent!==""){ // alert("检索内容了呢:"+searchContent); if ((misEnableState === true)&&isRightfulPrefix(searchContent)) { + details.url = "http://" + searchContent; // 如果检索内容模糊判断是一个前缀,且mis同步是开着的 // alert("成功加载mis的IP: "+misHost+"; misPrefix: "+misPrefix+", searchContent: "+searchContent); var host = misHost; @@ -674,7 +675,7 @@ function handleRedirect(details) { load("storage", reload); // alert("已经重新更新了本地映射表"); // 缓存映射表更新之后,执行重定向操作 - details.url = "http://" + searchContent; + // details.url = "http://" + searchContent; // window.location.replace("http://www.runoob.com"); // window.location.href=details.url; // alert("刷新到:"+details.url); @@ -703,19 +704,14 @@ function handleRedirect(details) { return redirect(details); } }); - // 卡两秒 - sleep(5000); + return { + redirectUrl: details.url + }; }else{ - // 直接尝试重定向 - if (_redirect_promise_supported) { - var promise = new Promise(function (resolve, reject) { - var blockingResponse = redirect(details); - return resolve(blockingResponse); - }); - return promise; - } else { - return redirect(details); - } + // 如果是搜索了一个内容,该内容没命中缓存, + // 且mis没开,或该内容不符合前缀标识符表示规则, + // 则该内容一定是不会命中一个映射表项的 + return {}; } }else{ // 如果不是进行搜索,且本地没有命中映射表,则异步请求mis更新映射表