Bug 1488373 - Use target.getFront to instantiate StyleSheetsFront; r=ochameau
authoryulia <ystartsev@mozilla.com>
Thu, 27 Sep 2018 15:44:54 +0000
changeset 494643 2d9900b114f1fce25926a83638c5946efdca3e4c
parent 494642 7bc2e38aea7b83b6f54f4c213c42590efd4c0102
child 494644 570fdc8386296f3f6f5c008800b978aeacf7a17a
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1488373
milestone64.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 1488373 - Use target.getFront to instantiate StyleSheetsFront; r=ochameau Depends on D6768 Differential Revision: https://phabricator.services.mozilla.com/D7093
devtools/server/tests/browser/browser_stylesheets_getTextEmpty.js
devtools/server/tests/browser/browser_stylesheets_nested-iframes.js
--- a/devtools/server/tests/browser/browser_stylesheets_getTextEmpty.js
+++ b/devtools/server/tests/browser/browser_stylesheets_getTextEmpty.js
@@ -1,40 +1,29 @@
 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test that StyleSheetActor.getText handles empty text correctly.
 
-const {StyleSheetsFront} = require("devtools/shared/fronts/stylesheets");
-
 const CONTENT = "<style>body { background-color: #f06; }</style>";
 const TEST_URI = "data:text/html;charset=utf-8," + encodeURIComponent(CONTENT);
 
 add_task(async function() {
-  await addTab(TEST_URI);
-
-  info("Initialising the debugger server and client.");
-  initDebuggerServer();
-  const client = new DebuggerClient(DebuggerServer.connectPipe());
-  const form = await connectDebuggerClient(client);
-
-  info("Attaching to the active tab.");
-  await client.attachTarget(form.actor);
-
-  const front = StyleSheetsFront(client, form);
+  const target = await addTabTarget(TEST_URI);
+  const front = target.getFront("stylesheets");
   ok(front, "The StyleSheetsFront was created.");
 
   const sheets = await front.getStyleSheets();
   ok(sheets, "getStyleSheets() succeeded");
   is(sheets.length, 1,
      "getStyleSheets() returned the correct number of sheets");
 
   const sheet = sheets[0];
   await sheet.update("", false);
   const longStr = await sheet.getText();
   const source = await longStr.string();
   is(source, "", "text is empty");
 
-  await client.close();
+  await target.destroy();
 });
--- a/devtools/server/tests/browser/browser_stylesheets_nested-iframes.js
+++ b/devtools/server/tests/browser/browser_stylesheets_nested-iframes.js
@@ -2,36 +2,27 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test that StyleSheetsActor.getStyleSheets() works if an iframe does not have
 // a content document.
 
-const {StyleSheetsFront} = require("devtools/shared/fronts/stylesheets");
-
 add_task(async function() {
-  await addTab(MAIN_DOMAIN + "stylesheets-nested-iframes.html");
-
   info("Initialising the debugger server and client.");
-  initDebuggerServer();
-  const client = new DebuggerClient(DebuggerServer.connectPipe());
-  const form = await connectDebuggerClient(client);
+  const target = await addTabTarget(MAIN_DOMAIN + "stylesheets-nested-iframes.html");
 
-  info("Attaching to the active tab.");
-  await client.attachTarget(form.actor);
-
-  const front = StyleSheetsFront(client, form);
+  const front = target.getFront("stylesheets");
   ok(front, "The StyleSheetsFront was created.");
 
   const sheets = await front.getStyleSheets();
   ok(sheets, "getStyleSheets() succeeded even with documentless iframes.");
 
   // Bug 285395 limits the number of nested iframes to 10. There's one sheet per
   // frame so we should get 10 sheets. However, the limit might change in the
   // future so it's better not to rely on the limit. Asserting > 2 ensures that
   // the test page is actually loading nested iframes and this test is doing
   // something sensible (if we got this far, the test has served its purpose).
   ok(sheets.length > 2, sheets.length + " sheets found (expected 3 or more).");
 
-  await client.close();
+  await target.destroy();
 });