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: Created April 19, 2016, 1:59 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
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":
Sebastian Noack 2016/05/12 11:12:23 I think this should rather go into safari/contentB
kzar 2016/05/17 15:15:40 As discussed in IRC we can actually use prefs.get
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

Powered by Google App Engine
This is Rietveld