Bug 1340671 - [webext] Fix race in getDevToolsTargetForContext utility method. r=kmag
authorLuca Greco <lgreco@mozilla.com>
Fri, 17 Feb 2017 21:50:49 +0100
changeset 374977 be448fec20324601397e3df031bfeb417f50255d
parent 374976 3ae2288979324be626bc23971d03927ac495e379
child 374978 625d277367c3ace7d63658053db6106e8f254016
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1340671
milestone54.0a1
Bug 1340671 - [webext] Fix race in getDevToolsTargetForContext utility method. r=kmag MozReview-Commit-ID: 82r45FeljAV
browser/components/extensions/ext-devtools.js
--- a/browser/components/extensions/ext-devtools.js
+++ b/browser/components/extensions/ext-devtools.js
@@ -35,16 +35,17 @@ let initDevTools;
  *   A devtools extension proxy context.
  *
  * @returns {Promise<TabTarget>}
  *   The cloned devtools target associated to the context.
  */
 global.getDevToolsTargetForContext = (context) => {
   return Task.spawn(function* asyncGetTabTarget() {
     if (context.devToolsTarget) {
+      yield context.devToolsTarget.makeRemote();
       return context.devToolsTarget;
     }
 
     if (!context.devToolsToolbox || !context.devToolsToolbox.target) {
       throw new Error("Unable to get a TabTarget for a context not associated to any toolbox");
     }
 
     if (!context.devToolsToolbox.target.isLocalTab) {