Bug 1533679 - Implement very first Target domains. r=ato
authorAlexandre Poirot <poirot.alex@gmail.com>
Sun, 10 Mar 2019 12:51:11 +0000
changeset 521286 ea81ce60cfea
parent 521285 44e4bcd29904
child 521287 1c9116976d7f
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato
bugs1533679
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1533679 - Implement very first Target domains. r=ato Empty methods that are necessary to make puppeteer.connect to pass without throwing. Depends on D22692 Differential Revision: https://phabricator.services.mozilla.com/D22693
remote/domains/ParentProcessDomains.jsm
remote/domains/parent/Target.jsm
remote/jar.mn
remote/test/puppeteer-demo.js
--- a/remote/domains/ParentProcessDomains.jsm
+++ b/remote/domains/ParentProcessDomains.jsm
@@ -7,9 +7,10 @@
 var EXPORTED_SYMBOLS = ["ParentProcessDomains"];
 
 const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 const ParentProcessDomains = {};
 
 XPCOMUtils.defineLazyModuleGetters(ParentProcessDomains, {
   Browser: "chrome://remote/content/domains/parent/Browser.jsm",
+  Target: "chrome://remote/content/domains/parent/Target.jsm",
 });
copy from remote/domains/ParentProcessDomains.jsm
copy to remote/domains/parent/Target.jsm
--- a/remote/domains/ParentProcessDomains.jsm
+++ b/remote/domains/parent/Target.jsm
@@ -1,15 +1,20 @@
 /* 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 = ["ParentProcessDomains"];
+var EXPORTED_SYMBOLS = ["Target"];
 
-const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+const {Domain} = ChromeUtils.import("chrome://remote/content/domains/Domain.jsm");
 
-const ParentProcessDomains = {};
+class Target extends Domain {
+  getBrowserContexts() {
+    return {
+      browserContextIds: [],
+    };
+  }
 
-XPCOMUtils.defineLazyModuleGetters(ParentProcessDomains, {
-  Browser: "chrome://remote/content/domains/parent/Browser.jsm",
-});
+  setDiscoverTargets({ discover }) {
+  }
+}
--- a/remote/jar.mn
+++ b/remote/jar.mn
@@ -29,16 +29,17 @@ remote.jar:
   content/domains/Domain.jsm (domains/Domain.jsm)
   content/domains/Domains.jsm (domains/Domains.jsm)
   content/domains/ContentProcessDomain.jsm (domains/ContentProcessDomain.jsm)
   content/domains/ContentProcessDomains.jsm (domains/ContentProcessDomains.jsm)
   content/domains/ParentProcessDomains.jsm (domains/ParentProcessDomains.jsm)
   content/domains/content/Log.jsm (domains/content/Log.jsm)
   content/domains/content/Page.jsm (domains/content/Page.jsm)
   content/domains/parent/Browser.jsm (domains/parent/Browser.jsm)
+  content/domains/parent/Target.jsm (domains/parent/Target.jsm)
 
   # transport layer
   content/server/HTTPD.jsm (../netwerk/test/httpserver/httpd.js)
   content/server/Packet.jsm (server/Packet.jsm)
   content/server/Socket.jsm (server/Socket.jsm)
   content/server/Stream.jsm (server/Stream.jsm)
   content/server/Transport.jsm (server/Transport.jsm)
   content/server/WebSocket.jsm (server/WebSocket.jsm)
new file mode 100644
--- /dev/null
+++ b/remote/test/puppeteer-demo.js
@@ -0,0 +1,20 @@
+/**
+ * To run the server:
+ * $ ./mach run --remote-debugging-port=9000 --headless
+ *   (this requires `ac_add_options --enable-cdp` to be set in your mozconfig)
+ *
+ * To run the test script:
+ * $ npm install puppeteer
+ * $ DEBUG="puppeteer:protocol" node puppeteer-demo.js
+ */
+
+/* global require */
+
+const puppeteer = require("puppeteer");
+
+console.log("Calling puppeteer.connect");
+puppeteer.connect({ browserURL: "http://localhost:9000"}).then(async browser => {
+  console.log("Connect success!");
+
+  return browser.close();
+});