| 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 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> | 6 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 } | 87 } |
| 88 | 88 |
| 89 void ScriptLoader::didNotifySubtreeInsertionsToDocument() | 89 void ScriptLoader::didNotifySubtreeInsertionsToDocument() |
| 90 { | 90 { |
| 91 if (!m_parserInserted) | 91 if (!m_parserInserted) |
| 92 prepareScript(); // FIXME: Provide a real starting line number here. | 92 prepareScript(); // FIXME: Provide a real starting line number here. |
| 93 } | 93 } |
| 94 | 94 |
| 95 void ScriptLoader::childrenChanged() | 95 void ScriptLoader::childrenChanged() |
| 96 { | 96 { |
| 97 if (!m_parserInserted && m_element->inDocument()) | 97 if (!m_parserInserted && m_element->inShadowIncludingDocument()) |
| 98 prepareScript(); // FIXME: Provide a real starting line number here. | 98 prepareScript(); // FIXME: Provide a real starting line number here. |
| 99 } | 99 } |
| 100 | 100 |
| 101 void ScriptLoader::handleSourceAttribute(const String& sourceUrl) | 101 void ScriptLoader::handleSourceAttribute(const String& sourceUrl) |
| 102 { | 102 { |
| 103 if (ignoresLoadRequest() || sourceUrl.isEmpty()) | 103 if (ignoresLoadRequest() || sourceUrl.isEmpty()) |
| 104 return; | 104 return; |
| 105 | 105 |
| 106 prepareScript(); // FIXME: Provide a real starting line number here. | 106 prepareScript(); // FIXME: Provide a real starting line number here. |
| 107 } | 107 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 wasParserInserted = false; | 200 wasParserInserted = false; |
| 201 } | 201 } |
| 202 | 202 |
| 203 if (wasParserInserted && !client->asyncAttributeValue()) | 203 if (wasParserInserted && !client->asyncAttributeValue()) |
| 204 m_forceAsync = true; | 204 m_forceAsync = true; |
| 205 | 205 |
| 206 // FIXME: HTML5 spec says we should check that all children are either comme
nts or empty text nodes. | 206 // FIXME: HTML5 spec says we should check that all children are either comme
nts or empty text nodes. |
| 207 if (!client->hasSourceAttribute() && !m_element->hasChildren()) | 207 if (!client->hasSourceAttribute() && !m_element->hasChildren()) |
| 208 return false; | 208 return false; |
| 209 | 209 |
| 210 if (!m_element->inDocument()) | 210 if (!m_element->inShadowIncludingDocument()) |
| 211 return false; | 211 return false; |
| 212 | 212 |
| 213 if (!isScriptTypeSupported(supportLegacyTypes)) | 213 if (!isScriptTypeSupported(supportLegacyTypes)) |
| 214 return false; | 214 return false; |
| 215 | 215 |
| 216 if (wasParserInserted) { | 216 if (wasParserInserted) { |
| 217 m_parserInserted = true; | 217 m_parserInserted = true; |
| 218 m_forceAsync = false; | 218 m_forceAsync = false; |
| 219 } | 219 } |
| 220 | 220 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 } | 279 } |
| 280 | 280 |
| 281 return true; | 281 return true; |
| 282 } | 282 } |
| 283 | 283 |
| 284 bool ScriptLoader::fetchScript(const String& sourceUrl, FetchRequest::DeferOptio
n defer) | 284 bool ScriptLoader::fetchScript(const String& sourceUrl, FetchRequest::DeferOptio
n defer) |
| 285 { | 285 { |
| 286 ASSERT(m_element); | 286 ASSERT(m_element); |
| 287 | 287 |
| 288 RawPtr<Document> elementDocument(m_element->document()); | 288 RawPtr<Document> elementDocument(m_element->document()); |
| 289 if (!m_element->inDocument() || m_element->document() != elementDocument) | 289 if (!m_element->inShadowIncludingDocument() || m_element->document() != elem
entDocument) |
| 290 return false; | 290 return false; |
| 291 | 291 |
| 292 ASSERT(!m_resource); | 292 ASSERT(!m_resource); |
| 293 if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) { | 293 if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) { |
| 294 FetchRequest request(ResourceRequest(elementDocument->completeURL(source
Url)), m_element->localName()); | 294 FetchRequest request(ResourceRequest(elementDocument->completeURL(source
Url)), m_element->localName()); |
| 295 | 295 |
| 296 CrossOriginAttributeValue crossOrigin = crossOriginAttributeValue(m_elem
ent->fastGetAttribute(HTMLNames::crossoriginAttr)); | 296 CrossOriginAttributeValue crossOrigin = crossOriginAttributeValue(m_elem
ent->fastGetAttribute(HTMLNames::crossoriginAttr)); |
| 297 if (crossOrigin != CrossOriginAttributeNotSet) | 297 if (crossOrigin != CrossOriginAttributeNotSet) |
| 298 request.setCrossOriginAccessControl(elementDocument->getSecurityOrig
in(), crossOrigin); | 298 request.setCrossOriginAccessControl(elementDocument->getSecurityOrig
in(), crossOrigin); |
| 299 request.setCharset(scriptCharset()); | 299 request.setCharset(scriptCharset()); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 dispatchErrorEvent(); | 476 dispatchErrorEvent(); |
| 477 detach(); | 477 detach(); |
| 478 return; | 478 return; |
| 479 } | 479 } |
| 480 contextDocument->scriptRunner()->notifyScriptReady(this, runOrder); | 480 contextDocument->scriptRunner()->notifyScriptReady(this, runOrder); |
| 481 m_pendingScript->stopWatchingForLoad(); | 481 m_pendingScript->stopWatchingForLoad(); |
| 482 } | 482 } |
| 483 | 483 |
| 484 bool ScriptLoader::ignoresLoadRequest() const | 484 bool ScriptLoader::ignoresLoadRequest() const |
| 485 { | 485 { |
| 486 return m_alreadyStarted || m_isExternalScript || m_parserInserted || !elemen
t() || !element()->inDocument(); | 486 return m_alreadyStarted || m_isExternalScript || m_parserInserted || !elemen
t() || !element()->inShadowIncludingDocument(); |
| 487 } | 487 } |
| 488 | 488 |
| 489 bool ScriptLoader::isScriptForEventSupported() const | 489 bool ScriptLoader::isScriptForEventSupported() const |
| 490 { | 490 { |
| 491 String eventAttribute = client()->eventAttributeValue(); | 491 String eventAttribute = client()->eventAttributeValue(); |
| 492 String forAttribute = client()->forAttributeValue(); | 492 String forAttribute = client()->forAttributeValue(); |
| 493 if (eventAttribute.isNull() || forAttribute.isNull()) | 493 if (eventAttribute.isNull() || forAttribute.isNull()) |
| 494 return true; | 494 return true; |
| 495 | 495 |
| 496 forAttribute = forAttribute.stripWhiteSpace(); | 496 forAttribute = forAttribute.stripWhiteSpace(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 522 if (isHTMLScriptLoader(element)) | 522 if (isHTMLScriptLoader(element)) |
| 523 return toHTMLScriptElement(element)->loader(); | 523 return toHTMLScriptElement(element)->loader(); |
| 524 | 524 |
| 525 if (isSVGScriptLoader(element)) | 525 if (isSVGScriptLoader(element)) |
| 526 return toSVGScriptElement(element)->loader(); | 526 return toSVGScriptElement(element)->loader(); |
| 527 | 527 |
| 528 return 0; | 528 return 0; |
| 529 } | 529 } |
| 530 | 530 |
| 531 } // namespace blink | 531 } // namespace blink |
| OLD | NEW |