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

Side by Side Diff: background.js

Issue 8354161: Align whitelisting behavior in Chrome with Firefox (Closed)
Patch Set: Created Sept. 18, 2012, 3:14 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrequest.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 importAll("filterClasses", this); 1 importAll("filterClasses", this);
2 importAll("subscriptionClasses", this); 2 importAll("subscriptionClasses", this);
3 importAll("filterStorage", this); 3 importAll("filterStorage", this);
4 importAll("elemHide", this); 4 importAll("elemHide", this);
5 importAll("filterListener", this); 5 importAll("filterListener", this);
6 importAll("filterNotifier", this); 6 importAll("filterNotifier", this);
7 importAll("matcher", this); 7 importAll("matcher", this);
8 importAll("synchronizer", this); 8 importAll("synchronizer", this);
9 9
10 // Some types cannot be distinguished 10 // Some types cannot be distinguished
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 delete localStorage.specialCaseYouTube; 44 delete localStorage.specialCaseYouTube;
45 if ("experimental" in localStorage) 45 if ("experimental" in localStorage)
46 delete localStorage.experimental; 46 delete localStorage.experimental;
47 } 47 }
48 48
49 // Upgrade options before we do anything else. 49 // Upgrade options before we do anything else.
50 setDefaultOptions(); 50 setDefaultOptions();
51 51
52 /** 52 /**
53 * Checks whether a page is whitelisted. 53 * Checks whether a page is whitelisted.
54 * @param url {String} 54 * @param {String} url
55 * @param {String} [type] content type to be checked, default is "DOCUMENT"
55 * @return {Filter} filter that matched the URL or null if not whitelisted 56 * @return {Filter} filter that matched the URL or null if not whitelisted
56 */ 57 */
57 function isWhitelisted(url, type) 58 function isWhitelisted(url, type)
58 { 59 {
59 // Ignore fragment identifier 60 // Ignore fragment identifier
60 var index = url.indexOf("#"); 61 var index = url.indexOf("#");
61 if (index >= 0) 62 if (index >= 0)
62 url = url.substring(0, index); 63 url = url.substring(0, index);
63 64
64 var result = defaultMatcher.matchesAny(url, type || "DOCUMENT", extractHostFro mURL(url), false); 65 var result = defaultMatcher.matchesAny(url, type || "DOCUMENT", extractHostFro mURL(url), false);
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 case "get-settings": 357 case "get-settings":
357 var hostDomain = null; 358 var hostDomain = null;
358 var selectors = null; 359 var selectors = null;
359 360
360 // HACK: We don't know which frame sent us the message, try to find it 361 // HACK: We don't know which frame sent us the message, try to find it
361 // in webRequest's frame data. 362 // in webRequest's frame data.
362 var tabId = -1; 363 var tabId = -1;
363 var frameId = -1; 364 var frameId = -1;
364 if (sender.tab) 365 if (sender.tab)
365 { 366 {
366 var tabId = sender.tab.id; 367 tabId = sender.tab.id;
367 if (tabId in frames) 368 if (tabId in frames)
368 { 369 {
369 for (var f in frames[tabId]) 370 for (var f in frames[tabId])
370 { 371 {
371 if (getFrameUrl(tabId, f) == request.frameUrl) 372 if (getFrameUrl(tabId, f) == request.frameUrl)
372 { 373 {
373 frameId = f; 374 frameId = f;
374 break; 375 break;
375 } 376 }
376 } 377 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 refreshIconAndContextMenu(windows[i].tabs[j]); 487 refreshIconAndContextMenu(windows[i].tabs[j]);
487 }); 488 });
488 489
489 // Update icon if a tab changes location 490 // Update icon if a tab changes location
490 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) 491 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab)
491 { 492 {
492 chrome.tabs.sendRequest(tabId, {reqtype: "clickhide-deactivate"}) 493 chrome.tabs.sendRequest(tabId, {reqtype: "clickhide-deactivate"})
493 if(changeInfo.status == "loading") 494 if(changeInfo.status == "loading")
494 refreshIconAndContextMenu(tab); 495 refreshIconAndContextMenu(tab);
495 }); 496 });
OLDNEW
« no previous file with comments | « no previous file | webrequest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld