long7181226 / compatibility-detector

Automatically exported from code.google.com/p/compatibility-detector
Apache License 2.0
0 stars 0 forks source link

The advanced detection's result tab is blank. #140

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
1. Open http://www.10010.com/
2. Run advanced detection.
3. Click the input box of “验证码”.
4. Click 'Advanced' of pop-up page again.
5. The advanced detection's result tab is blank.

Original issue reported on code.google.com by sundongg...@beyondsoft.com on 25 Jan 2011 at 9:52

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
造成这个问题的原因是点击“验证码”后,页面改变了一个 
IFRAME 标签的 src,该 IFRAME 开始载入一个新页面。

这个动作造成 Extension 的 background.html 中设置的监听函数:
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
  ...
});
被触发,导致该 tab 页的高级检测数据被删除。

由于数据被删,因此看到了空白页。

解决方案:
将上述事件监听器绑定在 content script 中:
window.addEventListener('unload', function() {
  ...
});
发送消息到 background,以进行后续处理(删除数据)。

Original comment by sundongg...@beyondsoft.com on 25 Jan 2011 at 10:34

GoogleCodeExporter commented 9 years ago
chrome.tabs.onUpdated 能否区分出是 iframe 还是主窗口发生变化?

Original comment by markhu...@google.com on 26 Jan 2011 at 7:16

GoogleCodeExporter commented 9 years ago
Revision: 399

注:无法区分。
一个 tab 页在 chrome.tabs.onUpdated 
事件被触发时,事件处理函数中能得到两种状态:
载入中 =  loading,载入完成 = complete

在页面创建新 IFRAME/IMG,追加入文档树,然后设置其 
src,不会触发上述事件。
在页面创建新 IFRAME/IMG,设置其 
src,然后追加入文档树,不会触发上述事件。
页面的 IFRAME reload,也不会触发上述时间。
只有在修改页面中已有 src 的 IFRAME 的 
src,才会将触发上述事件。

Original comment by sundongg...@beyondsoft.com on 26 Jan 2011 at 9:14