OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 void HTMLScriptElement::childrenChanged(const ChildrenChange& change) | 68 void HTMLScriptElement::childrenChanged(const ChildrenChange& change) |
69 { | 69 { |
70 HTMLElement::childrenChanged(change); | 70 HTMLElement::childrenChanged(change); |
71 m_loader->childrenChanged(); | 71 m_loader->childrenChanged(); |
72 } | 72 } |
73 | 73 |
74 void HTMLScriptElement::didMoveToNewDocument(Document& oldDocument) | 74 void HTMLScriptElement::didMoveToNewDocument(Document& oldDocument) |
75 { | 75 { |
76 RefPtrWillBeRawPtr<Document> contextDocument = document().contextDocument().
get(); | 76 RefPtrWillBeRawPtr<Document> contextDocument = document().contextDocument().
get(); |
77 if (!contextDocument) { | 77 if (!contextDocument) { |
| 78 // Document's contextDocument() method will return no Document if the |
| 79 // following conditions both hold: |
| 80 // |
| 81 // - The Document wasn't created with an explicit context document |
| 82 // and that document is otherwise kept alive. |
| 83 // - The Document itself is detached from its frame. |
| 84 // |
| 85 // The script element's loader is in that case moved to document() and |
| 86 // its script runner, which is the non-null Document that contextDocumen
t() |
| 87 // would return if not detached. |
78 ASSERT(!document().frame()); | 88 ASSERT(!document().frame()); |
79 // A frame-detached document is handled as having no context | |
80 // document - it would be the document if not detached. The | |
81 // newly moved script element needs to be the latter here as | |
82 // the script loader for the pending script must also move to | |
83 // reside with that document and its script runner. | |
84 contextDocument = &document(); | 89 contextDocument = &document(); |
85 } | 90 } |
86 oldDocument.scriptRunner()->movePendingAsyncScript(contextDocument->scriptRu
nner(), m_loader.get()); | 91 oldDocument.scriptRunner()->movePendingAsyncScript(contextDocument->scriptRu
nner(), m_loader.get()); |
87 HTMLElement::didMoveToNewDocument(oldDocument); | 92 HTMLElement::didMoveToNewDocument(oldDocument); |
88 } | 93 } |
89 | 94 |
90 void HTMLScriptElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& value) | 95 void HTMLScriptElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& value) |
91 { | 96 { |
92 if (name == srcAttr) | 97 if (name == srcAttr) |
93 m_loader->handleSourceAttribute(value); | 98 m_loader->handleSourceAttribute(value); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 return adoptRefWillBeNoop(new HTMLScriptElement(document(), false, m_loader-
>alreadyStarted())); | 226 return adoptRefWillBeNoop(new HTMLScriptElement(document(), false, m_loader-
>alreadyStarted())); |
222 } | 227 } |
223 | 228 |
224 void HTMLScriptElement::trace(Visitor* visitor) | 229 void HTMLScriptElement::trace(Visitor* visitor) |
225 { | 230 { |
226 visitor->trace(m_loader); | 231 visitor->trace(m_loader); |
227 HTMLElement::trace(visitor); | 232 HTMLElement::trace(visitor); |
228 } | 233 } |
229 | 234 |
230 } | 235 } |
OLD | NEW |