Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: webrequest.js

Issue 8756093: Fixed small memory leak (Closed)
Patch Set: Created Nov. 8, 2012, 4:14 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrequest.js
===================================================================
--- a/webrequest.js
+++ b/webrequest.js
@@ -17,6 +17,7 @@
chrome.webRequest.onBeforeRequest.addListener(onBeforeRequest, {urls: ["http://*/*", "https://*/*"]}, ["blocking"]);
chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["http://*/*", "https://*/*"]}, ["responseHeaders"]);
+chrome.tabs.onUpdated.addListener(onUpdated);
chrome.tabs.onRemoved.addListener(forgetTab);
var onFilterChangeTimeout = null;
@@ -50,6 +51,27 @@
var frames = {};
+function onUpdated(tabId, changeInfo, tab)
+{
+ var url = changeInfo.url;
+ if (url)
+ {
+ if (url.indexOf("#") > -1)
+ url = url.match(/^(.*?)#/) && RegExp.$1;
+ var lastURL = tabId in frames && frames[tabId].lastURL;
+ if (lastURL != url)
Wladimir Palant 2012/11/08 16:58:27 And now try window.history.pushState() to change U
+ {
+ if (lastURL)
+ forgetTab(tabId);
+
+ if (!(tabId in frames))
+ frames[tabId] = {};
+
+ frames[tabId].lastURL = url;
+ }
+ }
+}
+
function onBeforeRequest(details)
{
if (details.tabId == -1)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld