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

Side by Side Diff: firstRun.js

Issue 8689057: adblockpluschrome: Fix popup origin check when running on adblockplus.org (Closed)
Patch Set: Created Oct. 26, 2012, 11:50 a.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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 var backgroundPage = chrome.extension.getBackgroundPage(); 1 var backgroundPage = chrome.extension.getBackgroundPage();
2 var require = backgroundPage.require; 2 var require = backgroundPage.require;
3 var Prefs = require("prefs").Prefs; 3 var Prefs = require("prefs").Prefs;
4 var Utils = require("utils").Utils; 4 var Utils = require("utils").Utils;
5 var Filter = require("filterClasses").Filter;
5 6
6 function openSharePopup(url) 7 function openSharePopup(url)
7 { 8 {
8 var iframe = document.getElementById("share-popup"); 9 var iframe = document.getElementById("share-popup");
9 var glassPane = document.getElementById("glass-pane"); 10 var glassPane = document.getElementById("glass-pane");
10 var popupMessageReceived = false; 11 var popupMessageReceived = false;
11 12
12 var popupMessageListener = function(event) 13 var popupMessageListener = function(event)
13 { 14 {
14 if (event.origin !== url) 15 var originFilter = Filter.fromText("||adblockplus.org^");
16 if (!originFilter.matches(event.origin, "OTHER", null, null))
15 return; 17 return;
16 18
17 iframe.width = event.data.width; 19 iframe.width = event.data.width;
18 iframe.height = event.data.height; 20 iframe.height = event.data.height;
19 popupMessageReceived = true; 21 popupMessageReceived = true;
20 window.removeEventListener("message", popupMessageListener); 22 window.removeEventListener("message", popupMessageListener);
21 }; 23 };
22 window.addEventListener("message", popupMessageListener, false); 24 window.addEventListener("message", popupMessageListener, false);
23 25
24 var popupLoadListener = function() 26 var popupLoadListener = function()
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 116 }
115 } 117 }
116 } 118 }
117 119
118 function getDocLink(page, anchor) 120 function getDocLink(page, anchor)
119 { 121 {
120 return Prefs.documentation_link 122 return Prefs.documentation_link
121 .replace(/%LINK%/g, page) 123 .replace(/%LINK%/g, page)
122 .replace(/%LANG%/g, Utils.appLocale) + (anchor ? "#" + anchor : "" ); 124 .replace(/%LANG%/g, Utils.appLocale) + (anchor ? "#" + anchor : "" );
123 } 125 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld