Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / html / HTMLScriptElement.cpp
index 0f6df59..a9dbdbe 100644 (file)
@@ -30,6 +30,7 @@
 #include "core/dom/Attribute.h"
 #include "core/dom/Document.h"
 #include "core/dom/ScriptLoader.h"
+#include "core/dom/ScriptRunner.h"
 #include "core/dom/Text.h"
 #include "core/events/Event.h"
 
@@ -41,7 +42,6 @@ inline HTMLScriptElement::HTMLScriptElement(Document& document, bool wasInserted
     : HTMLElement(scriptTag, document)
     , m_loader(ScriptLoader::create(this, wasInsertedByParser, alreadyStarted))
 {
-    ScriptWrappable::init(this);
 }
 
 PassRefPtrWillBeRawPtr<HTMLScriptElement> HTMLScriptElement::create(Document& document, bool wasInsertedByParser, bool alreadyStarted)
@@ -70,6 +70,13 @@ void HTMLScriptElement::childrenChanged(const ChildrenChange& change)
     m_loader->childrenChanged();
 }
 
+void HTMLScriptElement::didMoveToNewDocument(Document& oldDocument)
+{
+    if (RefPtrWillBeRawPtr<Document> contextDocument = document().contextDocument().get())
+        oldDocument.scriptRunner()->movePendingAsyncScript(contextDocument->scriptRunner(), m_loader.get());
+    HTMLElement::didMoveToNewDocument(oldDocument);
+}
+
 void HTMLScriptElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
 {
     if (name == srcAttr)