DescriptionClean-up of the asynchronous behaviour of the experimental extension popup API.
- It was previously possible to programmatically launch two popups from the same extension. (Simply call popup.show twice in a row, or in a callback chain.)
I removed this incorrect funcationality by registering ExtensionPopupHost to listen for EXTENSION_HOST_CREATED notifications. If a popup is shown, and a new ExtensionHost is constructed of type EXTENSION_POPUP, then the presently displayed popup is dismissed.
- The callback function for popup.show(...) was previously called in response to EXTENSION_POPUP_VIEW_READY, as processed in response to a ViewHostMsg_DocumentAvailableInMainFrame message. This message wassent after PARSING of the conent of the popup view. Because of this behaviour, the API was difficult to use because one could not meaningfully interact with the popup page
during the callback: The callback would race with completion of the onload handler within the popup, so some sort of polling for onload-complete was required.
I fixed the problem by adding new notifications and messages so that EXTENSION_POPUP_VIEW_READY is now sent only after all onload handlers have been invoked.Corresponding unit-tests have also been added.
BUG=None
TEST=ExtensionApiTest.Popup
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=46136
Patch Set 1 #Patch Set 2 : '' #
Total comments: 10
Patch Set 3 : '' #Patch Set 4 : '' #Patch Set 5 : '' #Patch Set 6 : '' #
Total comments: 1
Patch Set 7 : '' #
Total comments: 4
Patch Set 8 : '' #Messages
Total messages: 13 (0 generated)
|