Fixes crash in HTMLIFrameElement and exposes HTMLIFrameElement::src

HTMLIFrameElement was adding the observer in navigateView. If the same
HTMLIFrameElement navigated multiple times HTMLIFrameElement would
attach itself as an observer more than once. ObserverList doesn't like
this.

Also adds src as an attribute of HTMLIFrameElement so that I can do:
iframe.src = xxx
in script

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/885783002
This commit is contained in:
Scott Violet 2015-01-28 19:47:26 -08:00
parent 218c5f98dc
commit e98fd07ffb
2 changed files with 5 additions and 2 deletions

View File

@ -35,8 +35,10 @@ void HTMLIFrameElement::insertedInto(ContainerNode* insertionPoint)
{
HTMLElement::insertedInto(insertionPoint);
if (insertionPoint->inDocument()) {
if (LocalFrame* frame = document().frame())
if (LocalFrame* frame = document().frame()) {
m_contentView = frame->loaderClient()->createChildFrame();
m_contentView->AddObserver(this);
}
navigateView();
}
}
@ -95,7 +97,6 @@ void HTMLIFrameElement::navigateView()
m_contentView->Embed(mojo::String::From(url.string().utf8().data()),
mojo::GetProxy(&m_services),
mojo::MakeProxy<mojo::ServiceProvider>(exposedServicesPipe.handle1.Pass()));
m_contentView->AddObserver(this);
}
}

View File

@ -3,6 +3,8 @@
// found in the LICENSE file.
interface HTMLIFrameElement : HTMLElement {
[Reflect, URL] attribute DOMString src;
[CallWith=ScriptState] any takeServicesHandle();
[CallWith=ScriptState] any takeExposedServicesHandle();
};