Title: [248176] trunk/Source/WebInspectorUI
- Revision
- 248176
- Author
- [email protected]
- Date
- 2019-08-02 13:25:01 -0700 (Fri, 02 Aug 2019)
Log Message
Web Inspector: "Inspector.initialized" happens before breakpoints are set
https://bugs.webkit.org/show_bug.cgi?id=200364
Reviewed by Joseph Pecoraro.
Allow managers to register a promise that will delay `Inspector.initialized`. This is needed
when restoring breakpoints so that "Automatically Show Web Inspector for JSContexts" can set
them before any scripts have evaluated, ensuring that no breakpoints are "skipped".
* UserInterface/Protocol/Target.js:
(WI.Target.prototype.initialize):
(WI.Target.registerInitializationPromise): Added.
* UserInterface/Controllers/DOMDebuggerManager.js:
(WI.DOMDebuggerManager):
* UserInterface/Controllers/DebuggerManager.js:
(WI.DebuggerManager):
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (248175 => 248176)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-08-02 20:22:18 UTC (rev 248175)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-08-02 20:25:01 UTC (rev 248176)
@@ -1,3 +1,23 @@
+2019-08-02 Devin Rousso <[email protected]>
+
+ Web Inspector: "Inspector.initialized" happens before breakpoints are set
+ https://bugs.webkit.org/show_bug.cgi?id=200364
+
+ Reviewed by Joseph Pecoraro.
+
+ Allow managers to register a promise that will delay `Inspector.initialized`. This is needed
+ when restoring breakpoints so that "Automatically Show Web Inspector for JSContexts" can set
+ them before any scripts have evaluated, ensuring that no breakpoints are "skipped".
+
+ * UserInterface/Protocol/Target.js:
+ (WI.Target.prototype.initialize):
+ (WI.Target.registerInitializationPromise): Added.
+
+ * UserInterface/Controllers/DOMDebuggerManager.js:
+ (WI.DOMDebuggerManager):
+ * UserInterface/Controllers/DebuggerManager.js:
+ (WI.DebuggerManager):
+
2019-08-01 Devin Rousso <[email protected]>
Unreviewed, remove `emulateUserGesture` parameter from `Debugger.evaluateOnCallFrame` for iOS 13
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMDebuggerManager.js (248175 => 248176)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMDebuggerManager.js 2019-08-02 20:22:18 UTC (rev 248175)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMDebuggerManager.js 2019-08-02 20:25:01 UTC (rev 248176)
@@ -53,27 +53,29 @@
WI.Frame.addEventListener(WI.Frame.Event.ChildFrameWasRemoved, this._childFrameWasRemoved, this);
WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
- let loadBreakpoints = async (constructor, objectStore, oldSettings, callback) => {
- for (let key of oldSettings) {
- let existingSerializedBreakpoints = WI.Setting.migrateValue(key);
- if (existingSerializedBreakpoints) {
- for (let existingSerializedBreakpoint of existingSerializedBreakpoints)
- await objectStore.putObject(constructor.deserialize(existingSerializedBreakpoint));
+ let loadBreakpoints = (constructor, objectStore, oldSettings, callback) => {
+ WI.Target.registerInitializationPromise((async () => {
+ for (let key of oldSettings) {
+ let existingSerializedBreakpoints = WI.Setting.migrateValue(key);
+ if (existingSerializedBreakpoints) {
+ for (let existingSerializedBreakpoint of existingSerializedBreakpoints)
+ await objectStore.putObject(constructor.deserialize(existingSerializedBreakpoint));
+ }
}
- }
- let serializedBreakpoints = await objectStore.getAll();
+ let serializedBreakpoints = await objectStore.getAll();
- this._restoringBreakpoints = true;
- for (let serializedBreakpoint of serializedBreakpoints) {
- let breakpoint = constructor.deserialize(serializedBreakpoint);
+ this._restoringBreakpoints = true;
+ for (let serializedBreakpoint of serializedBreakpoints) {
+ let breakpoint = constructor.deserialize(serializedBreakpoint);
- const key = null;
- objectStore.associateObject(breakpoint, key, serializedBreakpoint);
+ const key = null;
+ objectStore.associateObject(breakpoint, key, serializedBreakpoint);
- callback(breakpoint);
- }
- this._restoringBreakpoints = false;
+ callback(breakpoint);
+ }
+ this._restoringBreakpoints = false;
+ })());
};
if (this.supported) {
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js (248175 => 248176)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js 2019-08-02 20:22:18 UTC (rev 248175)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js 2019-08-02 20:25:01 UTC (rev 248176)
@@ -105,7 +105,7 @@
this._ignoreBreakpointDisplayLocationDidChangeEvent = false;
- (async () => {
+ WI.Target.registerInitializationPromise((async () => {
let existingSerializedBreakpoints = WI.Setting.migrateValue("breakpoints");
if (existingSerializedBreakpoints) {
for (let existingSerializedBreakpoint of existingSerializedBreakpoints)
@@ -124,7 +124,7 @@
this.addBreakpoint(breakpoint);
}
this._restoringBreakpoints = false;
- })();
+ })());
}
// Target
Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/Target.js (248175 => 248176)
--- trunk/Source/WebInspectorUI/UserInterface/Protocol/Target.js 2019-08-02 20:22:18 UTC (rev 248175)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/Target.js 2019-08-02 20:25:01 UTC (rev 248176)
@@ -86,7 +86,8 @@
WI.performOneTimeFrontendInitializationsUsingTarget(this);
});
- setTimeout(() => {
+ console.assert(Target._initializationPromises.length || Target._completedInitializationPromiseCount);
+ Promise.all(Target._initializationPromises).then(() => {
// Tell the backend we are initialized after all our initialization messages have been sent.
// This allows an automatically paused backend to resume execution, but we want to ensure
// our breakpoints were already sent to that backend.
@@ -131,6 +132,22 @@
get TimelineAgent() { return this._agents.Timeline; }
get WorkerAgent() { return this._agents.Worker; }
+ // Static
+
+ static registerInitializationPromise(promise)
+ {
+ // This can be called for work that has to be done before `Inspector.initialized` is called.
+ // Should only be called before the first target is created.
+ console.assert(!Target._completedInitializationPromiseCount);
+
+ Target._initializationPromises.push(promise);
+
+ promise.then(() => {
+ ++Target._completedInitializationPromiseCount;
+ Target._initializationPromises.remove(promise);
+ });
+ }
+
// Public
get identifier() { return this._identifier; }
@@ -215,3 +232,6 @@
ResourceAdded: "target-resource-added",
ScriptAdded: "target-script-added",
};
+
+WI.Target._initializationPromises = [];
+WI.Target._completedInitializationPromiseCount = 0;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes