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

Unified Diff: composer.postload.js

Issue 29570614: Issue 5028 - Use browser namespace (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Update buildtools dependency Created Oct. 16, 2017, 12:10 p.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
« no previous file with comments | « composer.js ('k') | dependencies » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: composer.postload.js
===================================================================
--- a/composer.postload.js
+++ b/composer.postload.js
@@ -40,17 +40,17 @@
let lastRightClickEventIsMostRecent = false;
/* Utilities */
function getFiltersForElement(element, callback)
{
let src = element.getAttribute("src");
- chrome.runtime.sendMessage({
+ browser.runtime.sendMessage({
type: "composer.getFilters",
tagName: element.localName,
id: element.id,
src: src && src.length <= 1000 ? src : null,
style: element.getAttribute("style"),
classes: Array.prototype.slice.call(element.classList),
urls: getURLsFromElement(element),
mediatype: typeMap.get(element.localName),
@@ -384,36 +384,36 @@
return;
let element = currentElement.prisoner || currentElement;
getFiltersForElement(element, (filters, selectors) =>
{
if (currentlyPickingElement)
stopPickingElement();
- chrome.runtime.sendMessage({
+ browser.runtime.sendMessage({
type: "composer.openDialog"
},
popupId =>
{
- chrome.runtime.sendMessage({
+ browser.runtime.sendMessage({
type: "forward",
targetPageId: popupId,
payload: {type: "composer.dialog.init", filters}
});
// Only the top frame keeps a record of the popup window's ID,
// so if this isn't the top frame we need to pass the ID on.
if (window == window.top)
{
blockelementPopupId = popupId;
}
else
{
- chrome.runtime.sendMessage({
+ browser.runtime.sendMessage({
type: "forward",
payload: {type: "composer.content.dialogOpened", popupId}
});
}
});
if (selectors.length > 0)
highlightElements(selectors.join(","));
@@ -446,17 +446,17 @@
// We're done with the block element feature for now, tidy everything up.
function deactivateBlockElement()
{
if (currentlyPickingElement)
stopPickingElement();
if (blockelementPopupId != null)
{
- chrome.runtime.sendMessage({
+ browser.runtime.sendMessage({
type: "forward",
targetPageId: blockelementPopupId,
payload:
{
type: "composer.dialog.close"
}
});
@@ -488,17 +488,17 @@
// We also need to make sure that the previous right click event,
// if there is one, is removed. We don't know which frame it is in so we must
// send a message to the other frames to clear their old right click events.
document.addEventListener("contextmenu", event =>
{
lastRightClickEvent = event;
lastRightClickEventIsMostRecent = true;
- chrome.runtime.sendMessage({
+ browser.runtime.sendMessage({
type: "forward",
payload:
{
type: "composer.content.clearPreviousRightClickEvent"
}
});
}, true);
@@ -557,23 +557,23 @@
if (window == window.top)
blockelementPopupId = msg.popupId;
break;
case "composer.content.dialogClosed":
// The onRemoved hook for the popup can create a race condition, so we
// to be careful here. (This is not perfect, but best we can do.)
if (window == window.top && blockelementPopupId == msg.popupId)
{
- chrome.runtime.sendMessage({
+ browser.runtime.sendMessage({
type: "forward",
payload:
{
type: "composer.content.finished"
}
});
}
break;
}
});
if (window == window.top)
- chrome.runtime.sendMessage({type: "composer.ready"});
+ browser.runtime.sendMessage({type: "composer.ready"});
}
« no previous file with comments | « composer.js ('k') | dependencies » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld