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

Issue 173649: Allow DOMUI pages to call window.open(), giving DOMUI privileges to the new (Closed)

Created:
11 years, 3 months ago by Matt Perry
Modified:
9 years, 7 months ago
Reviewers:
brettw
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

Allow DOMUI pages to call window.open(), giving DOMUI privileges to the new window (assuming it is on the same site instance). BUG=17636 TEST=no Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=25250

Patch Set 1 #

Patch Set 2 : crash fix and another test #

Patch Set 3 : formatting #

Total comments: 6

Patch Set 4 : more testing #

Total comments: 5

Patch Set 5 : comments #

Patch Set 6 : more comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+250 lines, -93 lines) Patch
M chrome/browser/dom_ui/dom_ui_factory.h View 1 2 3 4 5 1 chunk +13 lines, -0 lines 0 comments Download
M chrome/browser/dom_ui/dom_ui_factory.cc View 1 2 3 4 2 chunks +60 lines, -79 lines 0 comments Download
M chrome/browser/extensions/extension_browsertests_misc.cc View 1 2 3 1 chunk +88 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_dom_ui.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/extension_host.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/renderer_host/render_view_host.h View 1 chunk +5 lines, -1 line 0 comments Download
M chrome/browser/renderer_host/render_view_host.cc View 4 2 chunks +8 lines, -1 line 0 comments Download
M chrome/browser/tab_contents/render_view_host_delegate_helper.h View 2 chunks +3 lines, -1 line 0 comments Download
M chrome/browser/tab_contents/render_view_host_delegate_helper.cc View 2 chunks +2 lines, -1 line 0 comments Download
M chrome/browser/tab_contents/render_view_host_manager.h View 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/browser/tab_contents/render_view_host_manager.cc View 1 2 3 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/browser/tab_contents/tab_contents.h View 1 2 3 3 chunks +9 lines, -0 lines 0 comments Download
M chrome/browser/tab_contents/tab_contents.cc View 1 2 3 3 chunks +20 lines, -5 lines 0 comments Download
M chrome/browser/tab_contents/tab_contents_view.cc View 1 chunk +4 lines, -3 lines 0 comments Download
A chrome/test/data/extensions/uitest/window_open/manifest.json View 1 chunk +6 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/uitest/window_open/newtab.html View 1 2 3 1 chunk +12 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/uitest/window_open/test.html View 1 chunk +8 lines, -0 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
Matt Perry
11 years, 3 months ago (2009-09-01 22:20:12 UTC) #1
brettw
http://codereview.chromium.org/173649/diff/4001/5010 File chrome/browser/tab_contents/tab_contents.cc (right): http://codereview.chromium.org/173649/diff/4001/5010#newcode1283 Line 1283: if (opener_dom_ui_type_ == DOMUIFactory::GetDOMUIType(GetURL())) { Is there a ...
11 years, 3 months ago (2009-09-02 17:47:45 UTC) #2
Matt Perry
http://codereview.chromium.org/173649/diff/4001/5010 File chrome/browser/tab_contents/tab_contents.cc (right): http://codereview.chromium.org/173649/diff/4001/5010#newcode1283 Line 1283: if (opener_dom_ui_type_ == DOMUIFactory::GetDOMUIType(GetURL())) { On 2009/09/02 17:47:45, ...
11 years, 3 months ago (2009-09-02 20:42:18 UTC) #3
brettw
11 years, 3 months ago (2009-09-02 20:58:46 UTC) #4
LGTM

http://codereview.chromium.org/173649/diff/4001/5010
File chrome/browser/tab_contents/tab_contents.cc (right):

http://codereview.chromium.org/173649/diff/4001/5010#newcode1283
Line 1283: if (opener_dom_ui_type_ == DOMUIFactory::GetDOMUIType(GetURL())) {
On 2009/09/02 20:42:19, Matt Perry wrote:
> On 2009/09/02 17:47:45, brettw wrote:
> > Is there a test for if this comparison fails? Seems like something that
would
> be
> > good to make sure doesn't regress.
> 
> I added a test, and it uncovered a bug, so I fixed that too (see
> render_view_host.*).

Woot, thanks!

http://codereview.chromium.org/173649/diff/4001/5012
File chrome/browser/tab_contents/tab_contents_view.cc (right):

http://codereview.chromium.org/173649/diff/4001/5012#newcode38
Line 38: DOMUIFactory::GetDOMUIType(tab_contents_->GetURL()));
On 2009/09/02 20:42:19, Matt Perry wrote:
> On 2009/09/02 17:47:45, brettw wrote:
> > It seems weird to get the DOM UI type based on the URL of the source tab.
> Can't
> > we just ask the DOMUI for that tab? (It seems like DOMUIs should know their
> > type.) I don't feel strongly about this if it's a lot of work, it just
seemed
> > weird to me to have to do this.
> 
> The main reason I do it this way is for toolstrips - they don't have a DOMUI,
> since DOMUI is tab-centric. But we still want tabs opened via window.open to
> have extension privileges.

Done.

http://codereview.chromium.org/173649/diff/9001/9002
File chrome/browser/dom_ui/dom_ui_factory.cc (right):

http://codereview.chromium.org/173649/diff/9001/9002#newcode23
Line 23: typedef DOMUI* (*DOMUIFactoryFunction)(TabContents* tab_contents,
Can you document the return value of this, i.e. that it can be NULL and that the
caller owns the pointer?

http://codereview.chromium.org/173649/diff/9001/9002#newcode43
Line 43: static DOMUIFactoryFunction GetDOMUIFactoryFunction(const GURL& url) {
Can you document the return value here, and that it may be NULL.

http://codereview.chromium.org/173649/diff/9001/9002#newcode44
Line 44: // Currently, any gears: URL means an HTML dialog.
Need an extra space at the beginning here.

http://codereview.chromium.org/173649/diff/9001/9003
File chrome/browser/dom_ui/dom_ui_factory.h (right):

http://codereview.chromium.org/173649/diff/9001/9003#newcode14
Line 14: typedef void* DOMUITypeID;
Can you document this? I'm thinking something like "An opaque identifier used to
identify a DOMUI. External code can only compare this to DOMUIFactory::kNoDOMUI
and to compare two DOMUITypeIDs to each other for equality, otherwise it is for
internal DOMUI workings only."

http://codereview.chromium.org/173649/diff/9001/9007
File chrome/browser/renderer_host/render_view_host.cc (right):

http://codereview.chromium.org/173649/diff/9001/9007#newcode1612
Line 1612: BlockExtensionRequest(request_id);
Can you comment the cases where this can happen?

Powered by Google App Engine
This is Rietveld 408576698