summaryrefslogtreecommitdiffstats
path: root/browser/base/content/content.js
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-05-25 22:46:40 +0200
committerGitHub <noreply@github.com>2018-05-25 22:46:40 +0200
commit8f354e52d09d1bf2fadfbbfc141d4f32241599a4 (patch)
treeca3fcaa2a72700b85221b2fe75bb7d46d5d424ce /browser/base/content/content.js
parentd5459982f0d1bab08b751dc140c4cbe047032617 (diff)
parent72bab89cf6c77c9ee95a977c306e6ce317b84835 (diff)
downloadUXP-8f354e52d09d1bf2fadfbbfc141d4f32241599a4.tar
UXP-8f354e52d09d1bf2fadfbbfc141d4f32241599a4.tar.gz
UXP-8f354e52d09d1bf2fadfbbfc141d4f32241599a4.tar.lz
UXP-8f354e52d09d1bf2fadfbbfc141d4f32241599a4.tar.xz
UXP-8f354e52d09d1bf2fadfbbfc141d4f32241599a4.zip
Merge pull request #386 from MoonchildProductions/revert-381-masterPM28.0.0a2_Unstable
Revert "Remove the Social API"
Diffstat (limited to 'browser/base/content/content.js')
-rw-r--r--browser/base/content/content.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/browser/base/content/content.js b/browser/base/content/content.js
index 5758cb023..496e0d111 100644
--- a/browser/base/content/content.js
+++ b/browser/base/content/content.js
@@ -698,6 +698,37 @@ var PageMetadataMessenger = {
}
PageMetadataMessenger.init();
+addEventListener("ActivateSocialFeature", function (aEvent) {
+ let document = content.document;
+ let dwu = content.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils);
+ if (!dwu.isHandlingUserInput) {
+ Cu.reportError("attempt to activate provider without user input from " + document.nodePrincipal.origin);
+ return;
+ }
+
+ let node = aEvent.target;
+ let ownerDocument = node.ownerDocument;
+ let data = node.getAttribute("data-service");
+ if (data) {
+ try {
+ data = JSON.parse(data);
+ } catch (e) {
+ Cu.reportError("Social Service manifest parse error: " + e);
+ return;
+ }
+ } else {
+ Cu.reportError("Social Service manifest not available");
+ return;
+ }
+
+ sendAsyncMessage("Social:Activation", {
+ url: ownerDocument.location.href,
+ origin: ownerDocument.nodePrincipal.origin,
+ manifest: data
+ });
+}, true, true);
+
addMessageListener("ContextMenu:SaveVideoFrameAsImage", (message) => {
let video = message.objects.target;
let canvas = content.document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");