Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Issue 1512007: Disallow display of multiple experimental.extension.popup(...) windows (Closed)

Created:
10 years, 8 months ago by Jeff Timanus
Modified:
9 years, 7 months ago
CC:
chromium-reviews
Base URL:
svn://chrome-svn.corp.google.com/chrome/trunk/src/
Visibility:
Public.

Description

Clean-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 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+233 lines, -86 lines) Patch
M chrome/browser/extensions/extension_host.h View 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_host.cc View 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_popup_api.cc View 1 2 3 4 5 6 7 13 chunks +56 lines, -15 lines 0 comments Download
M chrome/browser/renderer_host/render_view_host.h View 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/renderer_host/render_view_host.cc View 2 3 4 5 6 7 2 chunks +6 lines, -0 lines 0 comments Download
M chrome/browser/renderer_host/render_view_host_delegate.h View 2 3 4 5 6 7 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/common/extensions/api/extension_api.json View 5 6 7 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/common/extensions/docs/extension.html View 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/docs/history.html View 5 6 7 30 chunks +61 lines, -61 lines 0 comments Download
M chrome/common/notification_type.h View 2 3 4 5 6 7 1 chunk +4 lines, -1 line 0 comments Download
M chrome/common/render_messages_internal.h View 2 3 4 5 6 7 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/renderer/extensions/extension_process_bindings.cc View 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M chrome/renderer/render_view.cc View 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M chrome/test/data/extensions/api_test/popup/toolband.html View 1 2 3 4 5 6 7 3 chunks +63 lines, -4 lines 0 comments Download
A chrome/test/data/extensions/api_test/popup/toolband_popup_a.html View 1 chunk +12 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/popup/toolband_popup_b.html View 1 chunk +12 lines, -0 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
Jeff Timanus
10 years, 8 months ago (2010-04-23 23:26:37 UTC) #1
Jeff Timanus
Hi Rafael, If you have a moment, could you please have a look at this? ...
10 years, 8 months ago (2010-04-26 19:41:02 UTC) #2
rafaelw1
Will get this to you by tonight. R On Mon, Apr 26, 2010 at 12:41 ...
10 years, 8 months ago (2010-04-26 20:32:02 UTC) #3
rafaelw
Also, please change the DCHECK in ExtensionProcessBindings from "is there at least returned view" to ...
10 years, 8 months ago (2010-04-27 03:32:10 UTC) #4
twiz
http://codereview.chromium.org/1512007/diff/4001/5002 File chrome/browser/extensions/extension_popup_api.cc (right): http://codereview.chromium.org/1512007/diff/4001/5002#newcode178 chrome/browser/extensions/extension_popup_api.cc:178: if (Details<ExtensionHost>(popup_->host()) != details && On 2010/04/27 03:32:10, rafaelw ...
10 years, 8 months ago (2010-04-27 05:44:11 UTC) #5
rafaelw
Also, please see my earlier summary comment about the DCHECK in ExtensionProcessBindings. http://codereview.chromium.org/1512007/diff/4001/5012 File chrome/renderer/render_view.cc ...
10 years, 8 months ago (2010-04-27 18:11:58 UTC) #6
Jeff Timanus
DCHECK changed as you suggested. Please let me know if there are any other issues ...
10 years, 8 months ago (2010-04-27 22:06:00 UTC) #7
twiz
http://codereview.chromium.org/1512007/diff/29003/47012 File chrome/renderer/render_view.cc (right): http://codereview.chromium.org/1512007/diff/29003/47012#newcode2720 chrome/renderer/render_view.cc:2720: Send(new ViewHostMsg_DocumentOnLoadCompletedInMainFrame(routing_id_)); You were correct: This call back will ...
10 years, 8 months ago (2010-04-28 15:48:16 UTC) #8
Jeff Timanus
+ Reviewers Erik & Aaron Erik and Aaron, you may care to comment on some ...
10 years, 7 months ago (2010-04-29 19:02:12 UTC) #9
Erik does not do reviews
I'm not going to have time for this in the next few days. Erik On ...
10 years, 7 months ago (2010-04-30 01:05:41 UTC) #10
rafaelw
+brettw Brett, please just check the new call through for render_view* lgtm w/ nits. http://codereview.chromium.org/1512007/diff/52001/53002 ...
10 years, 7 months ago (2010-04-30 01:27:57 UTC) #11
brettw
On Thu, Apr 29, 2010 at 6:27 PM, <rafaelw@chromium.org> wrote: > +brettw > > Brett, ...
10 years, 7 months ago (2010-04-30 05:08:37 UTC) #12
Jeff Timanus
10 years, 7 months ago (2010-04-30 17:11:03 UTC) #13
http://codereview.chromium.org/1512007/diff/52001/53002
File chrome/browser/extensions/extension_popup_api.cc (right):

http://codereview.chromium.org/1512007/diff/52001/53002#newcode307
chrome/browser/extensions/extension_popup_api.cc:307: // Popups may only be
displayed from TAB_CONTENTS and EXTENSION_TOOLSTRIP
On 2010/04/30 01:27:57, rafaelw wrote:
> nit: this should probably be the first thing that happens in this function. no
> sense doing all the input validation.

I had considered doing that too, but I didn't want to add yet another #ifdef
block at the top of the function.  (Upon further inspection, I've noticed that
render_view_host{_delegate}.h do not need to be wrapped in ifdefs, so I've made
the change you suggest.)

Done.

http://codereview.chromium.org/1512007/diff/52001/53007
File chrome/browser/renderer_host/render_view_host_delegate.h (right):

http://codereview.chromium.org/1512007/diff/52001/53007#newcode534
chrome/browser/renderer_host/render_view_host_delegate.h:534: // The
RenderView's main frame document element is ready, and the onload
On 2010/04/30 01:27:57, rafaelw wrote:
> Nit, I don't think repeating the first part of this comment from the above
> comment is necessary. Just focus on the onload having been handled.

Done.

Powered by Google App Engine
This is Rietveld 408576698