Bug 1488377 - Use target.getFront to instantiate CssPropertiesFront; r=ochameau
authoryulia <ystartsev@mozilla.com>
Mon, 08 Oct 2018 15:01:45 +0000
changeset 495878 463f83f78a0e38fc14a55697e7bddbe348305b3b
parent 495877 43866f1787dbd36e32b90bd472715344106f3025
child 495879 48bbc765210ac3344bc1013f6f578e3a6cd02929
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
bugs1488377
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 1488377 - Use target.getFront to instantiate CssPropertiesFront; r=ochameau Differential Revision: https://phabricator.services.mozilla.com/D7886
devtools/client/inspector/inspector.js
devtools/server/tests/mochitest/test_css-properties.html
devtools/shared/fronts/css-properties.js
--- a/devtools/client/inspector/inspector.js
+++ b/devtools/client/inspector/inspector.js
@@ -1449,17 +1449,16 @@ Inspector.prototype = {
       this._highlighters = null;
     }
 
     if (this._search) {
       this._search.destroy();
       this._search = null;
     }
 
-    const cssPropertiesDestroyer = this._cssProperties.front.destroy();
     const sidebarDestroyer = this.sidebar.destroy();
     const ruleViewSideBarDestroyer = this.ruleViewSideBar ?
       this.ruleViewSideBar.destroy() : null;
     const markupDestroyer = this._destroyMarkup();
 
     this.teardownToolbar();
 
     this.breadcrumbs.destroy();
@@ -1482,17 +1481,16 @@ Inspector.prototype = {
     this.resultsLength = null;
     this.searchBox = null;
     this.show3PaneTooltip = null;
     this.sidebar = null;
     this.store = null;
     this.telemetry = null;
 
     this._panelDestroyer = promise.all([
-      cssPropertiesDestroyer,
       markupDestroyer,
       sidebarDestroyer,
       ruleViewSideBarDestroyer
     ]);
 
     return this._panelDestroyer;
   },
 
--- a/devtools/server/tests/mochitest/test_css-properties.html
+++ b/devtools/server/tests/mochitest/test_css-properties.html
@@ -10,16 +10,18 @@ Bug 1265798 - Replace inIDOMUtils.cssPro
   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
   <script type="application/javascript" src="inspector-helpers.js"></script>
   <script type="application/javascript">
 "use strict";
 
 window.onload = function() {
   const { initCssProperties, getCssProperties } =
     require("devtools/shared/fronts/css-properties");
+  const { getFront } =
+    require("devtools/shared/protocol");
 
   function promiseAttachUrl(url) {
     return new Promise((resolve, reject) => {
       attachURL(url, function(err, client, tab, doc) {
         if (err) {
           return reject(err);
         }
         return resolve({client, tab, doc});
@@ -36,26 +38,28 @@ window.onload = function() {
 
     const attachmentA = await promiseAttachUrl(url);
     const attachmentB = await promiseAttachUrl(url);
 
     const toolboxMockA = {
       target: {
         hasActor: () => useActor,
         client: attachmentA.client,
-        form: attachmentA.tab
+        form: attachmentA.tab,
+        getFront: typeName => getFront(attachmentA.client, typeName, attachmentA.tab)
       },
       // Fake the window for css-properties.js's getClientBrowserVersion to work
       win: window
     };
     const toolboxMockB = {
       target: {
         hasActor: () => useActor,
         client: attachmentB.client,
-        form: attachmentB.tab
+        form: attachmentB.tab,
+        getFront: typeName => getFront(attachmentB.client, typeName, attachmentB.tab)
       },
       win: window
     };
 
     await initCssProperties(toolboxMockA);
     await initCssProperties(toolboxMockB);
 
     const cssProperties = getCssProperties(toolboxMockA);
--- a/devtools/shared/fronts/css-properties.js
+++ b/devtools/shared/fronts/css-properties.js
@@ -232,17 +232,17 @@ const initCssProperties = async function
   if (cachedCssProperties.has(client)) {
     return cachedCssProperties.get(client);
   }
 
   let db, front;
 
   // Get the list dynamically if the cssProperties actor exists.
   if (toolbox.target.hasActor("cssProperties")) {
-    front = CssPropertiesFront(client, toolbox.target.form);
+    front = toolbox.target.getFront("cssProperties");
     db = await front.getCSSDatabase();
   } else {
     // The target does not support this actor, so require a static list of supported
     // properties.
     db = CSS_PROPERTIES_DB;
   }
 
   const cssProperties = new CssProperties(normalizeCssData(db));