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

Delta Between Two Patch Sets: safari/ext/background.js

Issue 29336084: Issue 2426 - Open block.html as a popup window (Closed)
Left Patch Set: Addressed some initial feedback Created Feb. 10, 2016, 2:18 p.m.
Right Patch Set: Assume createData parameter has been given Created Feb. 17, 2016, 8:50 p.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 | « popup.js ('k') | subscriptionLink.postload.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 }; 268 };
269 269
270 ext.pages = { 270 ext.pages = {
271 open: function(url, callback) 271 open: function(url, callback)
272 { 272 {
273 var tab = safari.application.activeBrowserWindow.openTab(); 273 var tab = safari.application.activeBrowserWindow.openTab();
274 tab.url = url; 274 tab.url = url;
275 275
276 if (callback) 276 if (callback)
277 { 277 {
278 var onLoading = function(page) 278 var onNavigate = function(event)
279 { 279 {
280 if (page._tab == tab) 280 if (event.target == tab)
281 { 281 {
282 ext.pages.onLoading.removeListener(onLoading); 282 safari.application.removeEventListener(onNavigate);
283 callback(page); 283 callback(tab._visiblePage);
284 } 284 }
285 }; 285 };
286 ext.pages.onLoading.addListener(onLoading); 286
287 safari.application.addEventListener("navigate", onNavigate);
287 } 288 }
288 }, 289 },
289 query: function(info, callback) 290 query: function(info, callback)
290 { 291 {
291 var matchedPages = []; 292 var matchedPages = [];
292 293
293 for (var id in pages) 294 for (var id in pages)
294 { 295 {
295 var page = pages[id]; 296 var page = pages[id];
296 var win = page._tab.browserWindow; 297 var win = page._tab.browserWindow;
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 758
758 ext.pages.open(optionsUrl, callback); 759 ext.pages.open(optionsUrl, callback);
759 }; 760 };
760 761
761 /* Windows */ 762 /* Windows */
762 ext.windows = { 763 ext.windows = {
763 // Safari doesn't provide as rich a windows API as Chrome does, so instead 764 // Safari doesn't provide as rich a windows API as Chrome does, so instead
764 // of chrome.windows.create we have to fall back to just opening a new tab. 765 // of chrome.windows.create we have to fall back to just opening a new tab.
765 create: function(createData, callback) 766 create: function(createData, callback)
766 { 767 {
767 if (createData) 768 ext.pages.open(createData.url, callback);
768 ext.pages.open(createData.url, callback);
769 } 769 }
770 }; 770 };
771 })(); 771 })();
LEFTRIGHT

Powered by Google App Engine
This is Rietveld