Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.08 KB | None | 0 0
  1. diff --git a/devtools/client/webconsole/utils/context-menu.js b/devtools/client/webconsole/utils/context-menu.js
  2. index 29f0d485e57f..37115d70c9e5 100644
  3. --- a/devtools/client/webconsole/utils/context-menu.js
  4. +++ b/devtools/client/webconsole/utils/context-menu.js
  5. @@ -4,6 +4,8 @@
  6.  
  7. "use strict";
  8.  
  9. +// useful
  10. +
  11. const Menu = require("devtools/client/framework/menu");
  12. const MenuItem = require("devtools/client/framework/menu-item");
  13.  
  14. diff --git a/devtools/client/webconsole/webconsole-wrapper.js b/devtools/client/webconsole/webconsole-wrapper.js
  15. index 15d651279771..10bc443d40f2 100644
  16. --- a/devtools/client/webconsole/webconsole-wrapper.js
  17. +++ b/devtools/client/webconsole/webconsole-wrapper.js
  18. @@ -15,9 +15,13 @@ const actions = require("devtools/client/webconsole/actions/index");
  19. const {
  20. createEditContextMenu,
  21. } = require("devtools/client/framework/toolbox-context-menu");
  22. +
  23. +// context menu
  24. const {
  25. createContextMenu,
  26. } = require("devtools/client/webconsole/utils/context-menu");
  27. +
  28. +
  29. const { configureStore } = require("devtools/client/webconsole/store");
  30. const { PREFS } = require("devtools/client/webconsole/constants");
  31.  
  32. diff --git a/devtools/server/actors/object.js b/devtools/server/actors/object.js
  33. index 3acfc936b29b..b9185c0a3eb8 100644
  34. --- a/devtools/server/actors/object.js
  35. +++ b/devtools/server/actors/object.js
  36. @@ -108,17 +108,20 @@ const proto = {
  37. },
  38.  
  39. addWatchpoint(property, label, watchpointType) {
  40. + // We promote the object actor to the thread pool
  41. + // so that it lives for the lifetime of the watchpoint.
  42. + this.thread.threadObjectGrip(this);
  43. +
  44. if (this._originalDescriptors.has(property)) {
  45. return;
  46. }
  47. const desc = this.obj.getOwnPropertyDescriptor(property);
  48.  
  49. - //If there is already a setter or getter, don't add watchpoint.
  50. if (desc.set || desc.get) {
  51. return;
  52. }
  53.  
  54. - this._originalDescriptors.set(property, desc);
  55. + this._originalDescriptors.set(property, { desc, watchpointType });
  56.  
  57. const pauseAndRespond = () => {
  58. const frame = this.thread.dbg.getNewestFrame();
  59. @@ -137,6 +140,7 @@ const proto = {
  60. }),
  61. get: this.obj.makeDebuggeeValue(() => {
  62. pauseAndRespond();
  63. + return desc.value;
  64. }),
  65. });
  66. }
  67. @@ -146,8 +150,11 @@ const proto = {
  68. configurable: desc.configurable,
  69. enumerable: desc.enumerable,
  70. set: this.obj.makeDebuggeeValue(v => {
  71. - desc.value = v;
  72. pauseAndRespond();
  73. + desc.value = v;
  74. + }),
  75. + get: this.obj.makeDebuggeeValue(() => {
  76. + return desc.value;
  77. }),
  78. });
  79. }
  80. @@ -158,11 +165,17 @@ const proto = {
  81. return;
  82. }
  83.  
  84. - const desc = this._originalDescriptors.get(property);
  85. + const desc = this._originalDescriptors.get(property).desc;
  86. this._originalDescriptors.delete(property);
  87. this.obj.defineProperty(property, desc);
  88. },
  89.  
  90. + removeWatchpoints() {
  91. + this._originalDescriptors.forEach(
  92. + property => this.removeWatchpoint(property)
  93. + );
  94. + },
  95. +
  96. /**
  97. * Returns a grip for this actor for returning in a protocol message.
  98. */
  99. @@ -430,6 +443,13 @@ const proto = {
  100. return safeGetterValues;
  101. }
  102.  
  103. + // Do not search for safe getters while replaying. While this would be nice
  104. + // to support, it involves a lot of back-and-forth between processes and
  105. + // would be better to do entirely in the replaying process.
  106. + if (isReplaying) {
  107. + return safeGetterValues;
  108. + }
  109. +
  110. // Most objects don't have any safe getters but inherit some from their
  111. // prototype. Avoid calling getOwnPropertyNames on objects that may have
  112. // many properties like Array, strings or js objects. That to avoid
  113. @@ -781,8 +801,9 @@ const proto = {
  114. retval.writable = desc.writable;
  115. retval.value = this.hooks.createValueGrip(desc.value);
  116. } else if (this._originalDescriptors.has(name)) {
  117. - const value = this._originalDescriptors.get(name).value;
  118. - retval.value = this.hooks.createValueGrip(value);
  119. + const { desc, watchpointType } = this._originalDescriptors.get(name);
  120. + retval.value = this.hooks.createValueGrip(desc.value);
  121. + retval.watchpoint = watchpointType;
  122. } else {
  123. if ("get" in desc) {
  124. retval.get = this.hooks.createValueGrip(desc.get);
  125. @@ -1016,7 +1037,9 @@ const proto = {
  126. * Release the actor, when it isn't needed anymore.
  127. * Protocol.js uses this release method to call the destroy method.
  128. */
  129. - release: function() {},
  130. + release: function() {
  131. + this.removeWatchpoints()
  132. + },
  133. };
  134.  
  135. exports.ObjectActor = protocol.ActorClassWithSpec(objectSpec, proto);
  136. diff --git a/devtools/server/actors/root.js b/devtools/server/actors/root.js
  137. index c67ea1c8850c..6c0ba8a37dd3 100644
  138. --- a/devtools/server/actors/root.js
  139. +++ b/devtools/server/actors/root.js
  140. @@ -180,6 +180,9 @@ RootActor.prototype = {
  141. // Supports native log points and modifying the condition/log of an existing
  142. // breakpoints. Fx66+
  143. nativeLogpoints: true,
  144. +
  145. + // Supports watchpoints in the server. Fx71+
  146. + watchpoints: true,
  147. // support older browsers for Fx69+
  148. hasThreadFront: true,
  149. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement