Commit 5dd095ea authored by esprehn@chromium.org's avatar esprehn@chromium.org

HTMLLinkElement should not run script inside ::insertedInto

This was done in r165624 but was wrong, you cannot ever synchronously
dispatch the load or error event from inside didFinish since it means
you run can end up running script inside ::insertedInto.

It's not clear from the bug what the issue was, but the timing in the
test that I updated was also wrong since it had <link> elements firing
their load events synchronously while parsing.

There might be a real timing bug in imports, but firing the event
synchronously inside ::didFinish() isn't how to fix it.

BUG=336113, 357435, 357445

Review URL: https://codereview.chromium.org/214513011

git-svn-id: svn://svn.chromium.org/blink/trunk@170268 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent b36775ff
......@@ -9,7 +9,7 @@ function handle(event)
list.push(event.type + '@' + event.target.id);
if (list.length < 3)
return;
expected = ['load@shouldLoad', 'error@shouldError', 'click@toClick'];
expected = ['click@toClick', 'load@shouldLoad', 'error@shouldError'];
shouldBe('window.list', 'expected');
finishJSTest();
}
......
......@@ -352,11 +352,6 @@ void HTMLLinkElement::dispatchPendingEvent(LinkEventSender* eventSender)
{
ASSERT_UNUSED(eventSender, eventSender == &linkLoadEventSender());
ASSERT(m_link);
dispatchEventImmediately();
}
void HTMLLinkElement::dispatchEventImmediately()
{
if (m_link->hasLoaded())
linkLoaded();
else
......
......@@ -105,9 +105,7 @@ void LinkImport::didFinish()
{
if (!m_owner || !m_owner->inDocument())
return;
// Because didFinish() is called from import's own scheduler in HTMLImportsController,
// we don't need to scheduleEvent() here.
m_owner->dispatchEventImmediately();
m_owner->scheduleEvent();
}
void LinkImport::importChildWasDestroyed(HTMLImportChild* child)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment