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"}); |
} |