2016-02-01 22:02:30 +03:00
|
|
|
/* globals unsafeWindow, cloneInto */
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
2016-02-09 00:01:42 +03:00
|
|
|
window.addEventListener("content-to-addon", function(event) {
|
|
|
|
self.port.emit("content-to-addon", JSON.parse(event.detail));
|
2016-02-01 22:02:30 +03:00
|
|
|
}, false);
|
|
|
|
|
2016-02-09 00:01:42 +03:00
|
|
|
self.port.on("addon-to-content", function(data) {
|
2016-02-01 22:02:30 +03:00
|
|
|
const clonedData = cloneInto(data, document.defaultView);
|
|
|
|
window.dispatchEvent(
|
2016-02-09 00:01:42 +03:00
|
|
|
new CustomEvent("addon-to-content", {detail: clonedData})
|
2016-02-01 22:02:30 +03:00
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2016-02-09 00:01:42 +03:00
|
|
|
window.addEventListener("pagehide", function() {
|
|
|
|
self.port.emit("content-to-addon", {type: "pagehide"});
|
2016-02-01 22:02:30 +03:00
|
|
|
}, false);
|
2016-03-08 15:41:10 +03:00
|
|
|
|
|
|
|
document.onreadystatechange = function() {
|
|
|
|
self.port.emit("content-to-addon", {type: "NOTIFY_PERFORMANCE", data: "DOC_READY_STATE=" + document.readyState});
|
|
|
|
};
|
2016-07-01 01:54:02 +03:00
|
|
|
|
|
|
|
unsafeWindow.navigator.activity_streams_addon = true;
|