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

Side by Side Diff: safari/ext/background.js

Issue 29340571: Issue 3687 - Add experimental support for Safari content blockers (Closed)
Patch Set: Rebased Created May 17, 2016, 9:19 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 | « safari/contentBlocking.js ('k') | safari/ext/content.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 event.message = (results.indexOf(false) == -1); 413 event.message = (results.indexOf(false) == -1);
414 break; 414 break;
415 case "request": 415 case "request":
416 var response = null; 416 var response = null;
417 var sendResponse = function(message) { response = message; }; 417 var sendResponse = function(message) { response = message; };
418 418
419 ext.onMessage._dispatch(message.payload, sender, sendResponse); 419 ext.onMessage._dispatch(message.payload, sender, sendResponse);
420 420
421 event.message = response; 421 event.message = response;
422 break; 422 break;
423 case "useContentBlockerAPI":
424 event.message = require("prefs").Prefs["safariContentBlocker"];
425 break;
423 } 426 }
424 break; 427 break;
425 case "request": 428 case "request":
426 sender.page._messageProxy.handleRequest(message, sender); 429 sender.page._messageProxy.handleRequest(message, sender);
427 break; 430 break;
428 case "response": 431 case "response":
429 // All documents within a page have the same pageId and that's all we 432 // All documents within a page have the same pageId and that's all we
430 // care about here. 433 // care about here.
431 var pageId = tab._documentLookup[message.targetDocuments[0]].pageId; 434 var pageId = tab._documentLookup[message.targetDocuments[0]].pageId;
432 pages[pageId]._messageProxy.handleResponse(message); 435 pages[pageId]._messageProxy.handleResponse(message);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 /* Windows */ 590 /* Windows */
588 ext.windows = { 591 ext.windows = {
589 // Safari doesn't provide as rich a windows API as Chrome does, so instead 592 // Safari doesn't provide as rich a windows API as Chrome does, so instead
590 // of chrome.windows.create we have to fall back to just opening a new tab. 593 // of chrome.windows.create we have to fall back to just opening a new tab.
591 create: function(createData, callback) 594 create: function(createData, callback)
592 { 595 {
593 ext.pages.open(createData.url, callback); 596 ext.pages.open(createData.url, callback);
594 } 597 }
595 }; 598 };
596 })(); 599 })();
OLDNEW
« no previous file with comments | « safari/contentBlocking.js ('k') | safari/ext/content.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld