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

Unified Diff: safari/ext/background.js

Issue 5564089086509056: Issue 1801 - Use URL objects to process URLs in the background page (Closed)
Patch Set: Rebased and addressed comments Created Feb. 11, 2015, 10:54 a.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
Index: safari/ext/background.js
===================================================================
--- a/safari/ext/background.js
+++ b/safari/ext/background.js
@@ -26,7 +26,7 @@
{
this._id = id;
this._tab = tab;
- this._frames = [{url: url, parent: null}];
+ this._frames = [{url: new URL(url), parent: null}];
if (tab.page)
this._messageProxy = new ext._MessageProxy(tab.page);
@@ -574,7 +574,7 @@
{
var curFrame = curPage._frames[i];
- if (curFrame.url == message.referrer)
+ if (curFrame.url.href == message.referrer)
{
pageId = curPageId;
page = curPage;
@@ -600,18 +600,18 @@
}
frameId = page._frames.length;
- page._frames.push({url: message.url, parent: parentFrame});
+ page._frames.push({url: new URL(message.url), parent: parentFrame});
}
event.message = {pageId: pageId, frameId: frameId};
break;
case "webRequest":
var page = pages[event.message.pageId];
+ var frame = page._frames[event.message.frameId];
+
var results = ext.webRequest.onBeforeRequest._dispatch(
- event.message.url,
- event.message.type,
- page,
- page._frames[event.message.frameId]
+ new URL(event.message.url, frame.url),
+ event.message.type, page, frame
);
event.message = (results.indexOf(false) == -1);
@@ -669,7 +669,7 @@
var page = pages[id];
var tab = page._tab;
- if (page.url == optionsUrl && tab.browserWindow == safari.application.activeBrowserWindow)
+ if (page.url.href == optionsUrl && tab.browserWindow == safari.application.activeBrowserWindow)
{
tab.activate();
if (callback)
« qunit/tests/url.js ('K') | « qunit/tests/url.js ('k') | safari/ext/content.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld