| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "core/frame/SubresourceIntegrity.h" | 43 #include "core/frame/SubresourceIntegrity.h" |
| 44 #include "core/frame/UseCounter.h" | 44 #include "core/frame/UseCounter.h" |
| 45 #include "core/frame/csp/ContentSecurityPolicy.h" | 45 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 46 #include "core/html/HTMLScriptElement.h" | 46 #include "core/html/HTMLScriptElement.h" |
| 47 #include "core/html/imports/HTMLImport.h" | 47 #include "core/html/imports/HTMLImport.h" |
| 48 #include "core/html/parser/HTMLParserIdioms.h" | 48 #include "core/html/parser/HTMLParserIdioms.h" |
| 49 #include "core/inspector/ConsoleMessage.h" | 49 #include "core/inspector/ConsoleMessage.h" |
| 50 #include "core/svg/SVGScriptElement.h" | 50 #include "core/svg/SVGScriptElement.h" |
| 51 #include "platform/MIMETypeRegistry.h" | 51 #include "platform/MIMETypeRegistry.h" |
| 52 #include "platform/weborigin/SecurityOrigin.h" | 52 #include "platform/weborigin/SecurityOrigin.h" |
| 53 #include "public/platform/WebFrameScheduler.h" |
| 53 #include "wtf/StdLibExtras.h" | 54 #include "wtf/StdLibExtras.h" |
| 54 #include "wtf/text/StringBuilder.h" | 55 #include "wtf/text/StringBuilder.h" |
| 55 #include "wtf/text/StringHash.h" | 56 #include "wtf/text/StringHash.h" |
| 56 | 57 |
| 57 namespace blink { | 58 namespace blink { |
| 58 | 59 |
| 59 ScriptLoader::ScriptLoader(Element* element, bool parserInserted, bool alreadySt
arted) | 60 ScriptLoader::ScriptLoader(Element* element, bool parserInserted, bool alreadySt
arted) |
| 60 : m_element(element) | 61 : m_element(element) |
| 61 , m_resource(0) | 62 , m_resource(0) |
| 62 , m_startLineNumber(WTF::OrdinalNumber::beforeFirst()) | 63 , m_startLineNumber(WTF::OrdinalNumber::beforeFirst()) |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 m_pendingScript = PendingScript(m_element, m_resource.get()); | 253 m_pendingScript = PendingScript(m_element, m_resource.get()); |
| 253 contextDocument->scriptRunner()->queueScriptForExecution(this, ScriptRun
ner::IN_ORDER_EXECUTION); | 254 contextDocument->scriptRunner()->queueScriptForExecution(this, ScriptRun
ner::IN_ORDER_EXECUTION); |
| 254 // Note that watchForLoad can immediately call notifyFinished. | 255 // Note that watchForLoad can immediately call notifyFinished. |
| 255 m_pendingScript.watchForLoad(this); | 256 m_pendingScript.watchForLoad(this); |
| 256 } else if (client->hasSourceAttribute()) { | 257 } else if (client->hasSourceAttribute()) { |
| 257 m_pendingScript = PendingScript(m_element, m_resource.get()); | 258 m_pendingScript = PendingScript(m_element, m_resource.get()); |
| 258 LocalFrame* frame = m_element->document().frame(); | 259 LocalFrame* frame = m_element->document().frame(); |
| 259 if (frame) { | 260 if (frame) { |
| 260 ScriptState* scriptState = ScriptState::forMainWorld(frame); | 261 ScriptState* scriptState = ScriptState::forMainWorld(frame); |
| 261 if (scriptState->contextIsValid()) | 262 if (scriptState->contextIsValid()) |
| 262 ScriptStreamer::startStreaming(m_pendingScript, PendingScript::A
sync, frame->settings(), scriptState); | 263 ScriptStreamer::startStreaming(m_pendingScript, PendingScript::A
sync, frame->settings(), scriptState, frame->frameScheduler()->loadingTaskRunner
()); |
| 263 } | 264 } |
| 264 contextDocument->scriptRunner()->queueScriptForExecution(this, ScriptRun
ner::ASYNC_EXECUTION); | 265 contextDocument->scriptRunner()->queueScriptForExecution(this, ScriptRun
ner::ASYNC_EXECUTION); |
| 265 // Note that watchForLoad can immediately call notifyFinished. | 266 // Note that watchForLoad can immediately call notifyFinished. |
| 266 m_pendingScript.watchForLoad(this); | 267 m_pendingScript.watchForLoad(this); |
| 267 } else { | 268 } else { |
| 268 // Reset line numbering for nested writes. | 269 // Reset line numbering for nested writes. |
| 269 TextPosition position = elementDocument.isInDocumentWrite() ? TextPositi
on() : scriptStartPosition; | 270 TextPosition position = elementDocument.isInDocumentWrite() ? TextPositi
on() : scriptStartPosition; |
| 270 KURL scriptURL = (!elementDocument.isInDocumentWrite() && m_parserInsert
ed) ? elementDocument.url() : KURL(); | 271 KURL scriptURL = (!elementDocument.isInDocumentWrite() && m_parserInsert
ed) ? elementDocument.url() : KURL(); |
| 271 if (!executeScript(ScriptSourceCode(scriptContent(), scriptURL, position
))) { | 272 if (!executeScript(ScriptSourceCode(scriptContent(), scriptURL, position
))) { |
| 272 dispatchErrorEvent(); | 273 dispatchErrorEvent(); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 if (isHTMLScriptLoader(element)) | 497 if (isHTMLScriptLoader(element)) |
| 497 return toHTMLScriptElement(element)->loader(); | 498 return toHTMLScriptElement(element)->loader(); |
| 498 | 499 |
| 499 if (isSVGScriptLoader(element)) | 500 if (isSVGScriptLoader(element)) |
| 500 return toSVGScriptElement(element)->loader(); | 501 return toSVGScriptElement(element)->loader(); |
| 501 | 502 |
| 502 return 0; | 503 return 0; |
| 503 } | 504 } |
| 504 | 505 |
| 505 } // namespace blink | 506 } // namespace blink |
| OLD | NEW |