Bug 1472491: Part 5w - Add PageMetadataChild actor. r=mconley

MozReview-Commit-ID: DpTG8tTJCL4

--HG--
rename : browser/base/content/content.js => browser/actors/PageMetadataChild.jsm
extra : rebase_source : 6b6d4cd46b43ea784a05b60120b819500f2f4601
This commit is contained in:
Kris Maglione 2018-07-29 23:08:52 -07:00
Родитель 5f9fcd5684
Коммит 96bdaf839b
4 изменённых файлов: 44 добавлений и 26 удалений

Просмотреть файл

@ -0,0 +1,33 @@
/* vim: set ts=2 sw=2 sts=2 et tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = ["PageMetadataChild"];
ChromeUtils.import("resource://gre/actors/ActorChild.jsm");
ChromeUtils.defineModuleGetter(this, "ContextMenuChild",
"resource:///modules/ContextMenuChild.jsm");
ChromeUtils.defineModuleGetter(this, "PageMetadata",
"resource://gre/modules/PageMetadata.jsm");
class PageMetadataChild extends ActorChild {
receiveMessage(message) {
switch (message.name) {
case "PageMetadata:GetPageData": {
let target = ContextMenuChild.getTarget(this.mm, message);
let result = PageMetadata.getData(this.content.document, target);
this.mm.sendAsyncMessage("PageMetadata:PageDataResult", result);
break;
}
case "PageMetadata:GetMicroformats": {
let target = ContextMenuChild.getTarget(this.mm, message);
let result = PageMetadata.getMicroformats(this.content.document, target);
this.mm.sendAsyncMessage("PageMetadata:MicroformatsResult", result);
break;
}
}
}
}

Просмотреть файл

@ -28,6 +28,7 @@ FINAL_TARGET_FILES.actors += [
'NetErrorChild.jsm',
'OfflineAppsChild.jsm',
'PageInfoChild.jsm',
'PageMetadataChild.jsm',
'PageStyleChild.jsm',
'PluginChild.jsm',
'URIFixupChild.jsm',

Просмотреть файл

@ -22,7 +22,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
LoginFormFactory: "resource://gre/modules/LoginManagerContent.jsm",
InsecurePasswordUtils: "resource://gre/modules/InsecurePasswordUtils.jsm",
FormSubmitObserver: "resource:///modules/FormSubmitObserver.jsm",
PageMetadata: "resource://gre/modules/PageMetadata.jsm",
ContextMenuChild: "resource:///actors/ContextMenuChild.jsm",
});
@ -81,28 +80,3 @@ addMessageListener("rtcpeer:Deny", ContentWebRTCShim);
addMessageListener("webrtc:Allow", ContentWebRTCShim);
addMessageListener("webrtc:Deny", ContentWebRTCShim);
addMessageListener("webrtc:StopSharing", ContentWebRTCShim);
var PageMetadataMessenger = {
init() {
addMessageListener("PageMetadata:GetPageData", this);
addMessageListener("PageMetadata:GetMicroformats", this);
this.init = null;
},
receiveMessage(message) {
switch (message.name) {
case "PageMetadata:GetPageData": {
let target = ContextMenuChild.getTarget(global, message);
let result = PageMetadata.getData(content.document, target);
sendAsyncMessage("PageMetadata:PageDataResult", result);
break;
}
case "PageMetadata:GetMicroformats": {
let target = ContextMenuChild.getTarget(global, message);
let result = PageMetadata.getMicroformats(content.document, target);
sendAsyncMessage("PageMetadata:MicroformatsResult", result);
break;
}
}
}
};
PageMetadataMessenger.init();

Просмотреть файл

@ -169,6 +169,16 @@ let ACTORS = {
},
},
PageMetadata: {
child: {
module: "resource:///actors/PageMetadataChild.jsm",
messages: [
"PageMetadata:GetPageData",
"PageMetadata:GetMicroformats",
],
},
},
PageStyle: {
child: {
module: "resource:///actors/PageStyleChild.jsm",