mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 07:48:38 +09:00
Revert "Remove the Social API"
This commit is contained in:
parent
d7e628ffa5
commit
aa52f6bd53
52 changed files with 2895 additions and 16 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue