<browser>: Always read <browser>.src attribute from <object>.src.
If we navigate to 'http://www.google.com', then navigate to '' (empty src), reading <browser>.src would now give us (expected) 'http://www.google.com' since we ignore setting empty src attribute in browser_plugin.cc. BUG=149001 TEST=In web inspector, setting src on <browser> element and reading it. Added platform app test for verifying the change. Ran content_browsertests for BrowserPluginTest* and BrowserPluginHostTest* Review URL: https://chromiumcodereview.appspot.com/11111020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162011 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
chrome
browser
extensions
renderer
resources
extensions
test
data
extensions
platform_apps
browser_tag_src_attribute
content
@ -123,12 +123,13 @@ void BrowserPluginEmbedder::NavigateGuest(
|
||||
WebContentsImpl* guest_web_contents =
|
||||
static_cast<WebContentsImpl*>(guest->GetWebContents());
|
||||
|
||||
// We ignore loading empty urls in web_contents.
|
||||
// We do not load empty urls in web_contents.
|
||||
// If a guest sets empty src attribute after it has navigated to some
|
||||
// non-empty page, the action is considered no-op.
|
||||
// TODO(lazyboy): The js shim for browser-plugin might need to reflect empty
|
||||
// src ignoring in the shadow DOM element: http://crbug.com/149001.
|
||||
// non-empty page, the action is considered no-op. This empty src navigation
|
||||
// should never be sent to BrowserPluginEmbedder (browser process).
|
||||
DCHECK(!src.empty());
|
||||
if (!src.empty()) {
|
||||
// TODO(creis): Check the validity of the URL: http://crbug.com/139397.
|
||||
guest_web_contents->GetController().LoadURL(url,
|
||||
Referrer(),
|
||||
PAGE_TRANSITION_AUTO_SUBFRAME,
|
||||
|
@ -102,13 +102,13 @@ std::string BrowserPlugin::GetSrcAttribute() const {
|
||||
}
|
||||
|
||||
void BrowserPlugin::SetSrcAttribute(const std::string& src) {
|
||||
if (src == src_ && !guest_crashed_)
|
||||
if (src.empty() || (src == src_ && !guest_crashed_))
|
||||
return;
|
||||
|
||||
// If we haven't created the guest yet, do so now, if |src| is not empty and
|
||||
// we will navigate it right after creation. If |src| is empty, we can delay
|
||||
// the creation until we acutally need it.
|
||||
if (!navigate_src_sent_ && !src.empty()) {
|
||||
// If we haven't created the guest yet, do so now. We will navigate it right
|
||||
// after creation. If |src| is empty, we can delay the creation until we
|
||||
// acutally need it.
|
||||
if (!navigate_src_sent_) {
|
||||
BrowserPluginManager::Get()->Send(
|
||||
new BrowserPluginHostMsg_CreateGuest(
|
||||
render_view_->GetRoutingID(),
|
||||
@ -117,27 +117,20 @@ void BrowserPlugin::SetSrcAttribute(const std::string& src) {
|
||||
persist_storage_));
|
||||
}
|
||||
|
||||
if (navigate_src_sent_ || !src.empty()) {
|
||||
scoped_ptr<BrowserPluginHostMsg_ResizeGuest_Params> params(
|
||||
GetPendingResizeParams());
|
||||
DCHECK(!params->resize_pending);
|
||||
scoped_ptr<BrowserPluginHostMsg_ResizeGuest_Params> params(
|
||||
GetPendingResizeParams());
|
||||
DCHECK(!params->resize_pending);
|
||||
|
||||
BrowserPluginManager::Get()->Send(
|
||||
new BrowserPluginHostMsg_NavigateGuest(
|
||||
render_view_->GetRoutingID(),
|
||||
instance_id_,
|
||||
src,
|
||||
*params));
|
||||
// Record that we sent a NavigateGuest message to embedder. Once we send
|
||||
// such a message, subsequent SetSrcAttribute() calls must always send
|
||||
// NavigateGuest messages to the embedder (even if |src| is empty), so
|
||||
// resize works correctly for all cases (e.g. The embedder can reset the
|
||||
// guest's |src| to empty value, resize and then set the |src| to a
|
||||
// non-empty value).
|
||||
// Additionally, once this instance has navigated, the storage partition
|
||||
// cannot be changed, so this value is used for enforcing this.
|
||||
navigate_src_sent_ = true;
|
||||
}
|
||||
BrowserPluginManager::Get()->Send(
|
||||
new BrowserPluginHostMsg_NavigateGuest(
|
||||
render_view_->GetRoutingID(),
|
||||
instance_id_,
|
||||
src,
|
||||
*params));
|
||||
// Record that we sent a NavigateGuest message to embedder.
|
||||
// Once this instance has navigated, the storage partition cannot be changed,
|
||||
// so this value is used for enforcing this.
|
||||
navigate_src_sent_ = true;
|
||||
src_ = src;
|
||||
}
|
||||
|
||||
@ -207,8 +200,7 @@ void BrowserPlugin::ParseAttributes(const WebKit::WebPluginParams& params) {
|
||||
|
||||
// Set the 'src' attribute last, as it will set the has_navigated_ flag to
|
||||
// true, which prevents changing the 'partition' attribute.
|
||||
if (!src.empty())
|
||||
SetSrcAttribute(src);
|
||||
SetSrcAttribute(src);
|
||||
}
|
||||
|
||||
float BrowserPlugin::GetDeviceScaleFactor() const {
|
||||
|
Reference in New Issue
Block a user