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

Delta Between Two Patch Sets: firstRun.js

Issue 8689057: adblockpluschrome: Fix popup origin check when running on adblockplus.org (Closed)
Left Patch Set: Created Oct. 26, 2012, 9:39 a.m.
Right 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 5 var Filter = require("filterClasses").Filter;
6 function extractBaseUrl(url)
7 {
8 return url.split("/").slice(0, 3).join("/");
9 }
10 6
11 function openSharePopup(url) 7 function openSharePopup(url)
12 { 8 {
13 var iframe = document.getElementById("share-popup"); 9 var iframe = document.getElementById("share-popup");
14 var glassPane = document.getElementById("glass-pane"); 10 var glassPane = document.getElementById("glass-pane");
15 var popupMessageReceived = false; 11 var popupMessageReceived = false;
16 12
17 var popupMessageListener = function(event) 13 var popupMessageListener = function(event)
18 { 14 {
19 if (event.origin !== extractBaseUrl(url)) 15 var originFilter = Filter.fromText("||adblockplus.org^");
Wladimir Palant 2012/10/26 10:45:48 How about new backgroundPage.URI(url).prePath?
16 if (!originFilter.matches(event.origin, "OTHER", null, null))
20 return; 17 return;
21 18
22 iframe.width = event.data.width; 19 iframe.width = event.data.width;
23 iframe.height = event.data.height; 20 iframe.height = event.data.height;
24 popupMessageReceived = true; 21 popupMessageReceived = true;
25 window.removeEventListener("message", popupMessageListener); 22 window.removeEventListener("message", popupMessageListener);
26 }; 23 };
27 window.addEventListener("message", popupMessageListener, false); 24 window.addEventListener("message", popupMessageListener, false);
28 25
29 var popupLoadListener = function() 26 var popupLoadListener = function()
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 116 }
120 } 117 }
121 } 118 }
122 119
123 function getDocLink(page, anchor) 120 function getDocLink(page, anchor)
124 { 121 {
125 return Prefs.documentation_link 122 return Prefs.documentation_link
126 .replace(/%LINK%/g, page) 123 .replace(/%LINK%/g, page)
127 .replace(/%LANG%/g, Utils.appLocale) + (anchor ? "#" + anchor : "" ); 124 .replace(/%LANG%/g, Utils.appLocale) + (anchor ? "#" + anchor : "" );
128 } 125 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld