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, 9:39 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 5
6 function extractBaseUrl(url)
7 {
8 return url.split("/").slice(0, 3).join("/");
9 }
10
6 function openSharePopup(url) 11 function openSharePopup(url)
7 { 12 {
8 var iframe = document.getElementById("share-popup"); 13 var iframe = document.getElementById("share-popup");
9 var glassPane = document.getElementById("glass-pane"); 14 var glassPane = document.getElementById("glass-pane");
10 var popupMessageReceived = false; 15 var popupMessageReceived = false;
11 16
12 var popupMessageListener = function(event) 17 var popupMessageListener = function(event)
13 { 18 {
14 if (event.origin !== url) 19 if (event.origin !== extractBaseUrl(url))
Wladimir Palant 2012/10/26 10:45:48 How about new backgroundPage.URI(url).prePath?
15 return; 20 return;
16 21
17 iframe.width = event.data.width; 22 iframe.width = event.data.width;
18 iframe.height = event.data.height; 23 iframe.height = event.data.height;
19 popupMessageReceived = true; 24 popupMessageReceived = true;
20 window.removeEventListener("message", popupMessageListener); 25 window.removeEventListener("message", popupMessageListener);
21 }; 26 };
22 window.addEventListener("message", popupMessageListener, false); 27 window.addEventListener("message", popupMessageListener, false);
23 28
24 var popupLoadListener = function() 29 var popupLoadListener = function()
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 119 }
115 } 120 }
116 } 121 }
117 122
118 function getDocLink(page, anchor) 123 function getDocLink(page, anchor)
119 { 124 {
120 return Prefs.documentation_link 125 return Prefs.documentation_link
121 .replace(/%LINK%/g, page) 126 .replace(/%LINK%/g, page)
122 .replace(/%LANG%/g, Utils.appLocale) + (anchor ? "#" + anchor : "" ); 127 .replace(/%LANG%/g, Utils.appLocale) + (anchor ? "#" + anchor : "" );
123 } 128 }
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