This repository was archived by the owner on Sep 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Clean up Live Development agent loading #3203
Closed
iwehrman
wants to merge
3
commits into
master
from
iwehrman/synchronize-live-development-agent-loading
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -302,6 +302,8 @@ define(function DOMAgent(require, exports, module) { | |
|
|
||
| /** Initialize the agent */ | ||
| function load() { | ||
| var deferred = $.Deferred(); | ||
|
|
||
| _load = new $.Deferred(); | ||
| $(Inspector.Page) | ||
| .on("frameNavigated.DOMAgent", _onFrameNavigated) | ||
|
|
@@ -312,8 +314,14 @@ define(function DOMAgent(require, exports, module) { | |
| .on("childNodeCountUpdated.DOMAgent", _onChildNodeCountUpdated) | ||
| .on("childNodeInserted.DOMAgent", _onChildNodeInserted) | ||
| .on("childNodeRemoved.DOMAgent", _onChildNodeRemoved); | ||
| Inspector.Page.enable(); | ||
| return _load.promise(); | ||
| Inspector.Page.enable(function (response) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When playing round with disabling the DOMAgent, I discovered that the CSSAgent and RemoteAgent both depend on Inspector.Page being enabled so they get the loadEventFired event, so this needs to be moved out of DOMAgent.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This issue is captured in #2599, but I thought I'd mention it here :)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved |
||
| if (response.error) { | ||
| deferred.reject(null, response.error); | ||
| } else { | ||
| deferred.resolve(); | ||
| } | ||
| }); | ||
| return $.when(_load.promise(), deferred.promise()); | ||
| } | ||
|
|
||
| /** Clean up */ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding a callback each time (as shown here) I was wondering if we could update
Inspector._sendto always return a promise if no explicit callback is specified.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose so. I don't have a good feeling though for whether that can be done reliably across all API calls and whether that would have any other ramifications.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the change to
Inspector._sendto fix #3402 (in pull #3442). I'm not concerned about the reliability since the debugger API always sends a response for every method call. I think it makes sense if I reconcile your changes into my bug fix. What do you think?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think that makes a lot of sense. If you're bangin' away on Live Development this sprint, you might also take a look at the race I mentioned a few comments up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I probably won't dig into the loadAgents/unloadAgents race condition here since it doesn't immediately impact the Chrome 27 bug as far as I know. Randy did file a new bug #3390, so I'll reference your comment there.