Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(347)

Side by Side Diff: trunk/Source/core/dom/ScriptLoader.cpp

Issue 283333002: Revert 174019 "Make ScriptLoader into a ResourceOwner" (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « trunk/Source/core/dom/ScriptLoader.h ('k') | trunk/Source/core/fetch/ResourceOwner.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "platform/MIMETypeRegistry.h" 47 #include "platform/MIMETypeRegistry.h"
48 #include "platform/weborigin/SecurityOrigin.h" 48 #include "platform/weborigin/SecurityOrigin.h"
49 #include "wtf/StdLibExtras.h" 49 #include "wtf/StdLibExtras.h"
50 #include "wtf/text/StringBuilder.h" 50 #include "wtf/text/StringBuilder.h"
51 #include "wtf/text/StringHash.h" 51 #include "wtf/text/StringHash.h"
52 52
53 namespace WebCore { 53 namespace WebCore {
54 54
55 ScriptLoader::ScriptLoader(Element* element, bool parserInserted, bool alreadySt arted) 55 ScriptLoader::ScriptLoader(Element* element, bool parserInserted, bool alreadySt arted)
56 : m_element(element) 56 : m_element(element)
57 , m_resource(0)
57 , m_startLineNumber(WTF::OrdinalNumber::beforeFirst()) 58 , m_startLineNumber(WTF::OrdinalNumber::beforeFirst())
58 , m_parserInserted(parserInserted) 59 , m_parserInserted(parserInserted)
59 , m_isExternalScript(false) 60 , m_isExternalScript(false)
60 , m_alreadyStarted(alreadyStarted) 61 , m_alreadyStarted(alreadyStarted)
61 , m_haveFiredLoad(false) 62 , m_haveFiredLoad(false)
62 , m_willBeParserExecuted(false) 63 , m_willBeParserExecuted(false)
63 , m_readyToBeParserExecuted(false) 64 , m_readyToBeParserExecuted(false)
64 , m_willExecuteWhenDocumentFinishedParsing(false) 65 , m_willExecuteWhenDocumentFinishedParsing(false)
65 , m_forceAsync(!parserInserted) 66 , m_forceAsync(!parserInserted)
66 , m_willExecuteInOrder(false) 67 , m_willExecuteInOrder(false)
67 { 68 {
68 ASSERT(m_element); 69 ASSERT(m_element);
69 if (parserInserted && element->document().scriptableDocumentParser() && !ele ment->document().isInDocumentWrite()) 70 if (parserInserted && element->document().scriptableDocumentParser() && !ele ment->document().isInDocumentWrite())
70 m_startLineNumber = element->document().scriptableDocumentParser()->line Number(); 71 m_startLineNumber = element->document().scriptableDocumentParser()->line Number();
71 } 72 }
72 73
73 ScriptLoader::~ScriptLoader() 74 ScriptLoader::~ScriptLoader()
74 { 75 {
76 stopLoadRequest();
75 } 77 }
76 78
77 void ScriptLoader::didNotifySubtreeInsertionsToDocument() 79 void ScriptLoader::didNotifySubtreeInsertionsToDocument()
78 { 80 {
79 if (!m_parserInserted) 81 if (!m_parserInserted)
80 prepareScript(); // FIXME: Provide a real starting line number here. 82 prepareScript(); // FIXME: Provide a real starting line number here.
81 } 83 }
82 84
83 void ScriptLoader::childrenChanged() 85 void ScriptLoader::childrenChanged()
84 { 86 {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(type) || isLegacySup portedJavaScriptLanguage(language)) 158 if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(type) || isLegacySup portedJavaScriptLanguage(language))
157 return true; 159 return true;
158 } else if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(type.stripWhiteSp ace()) || (supportLegacyTypes == AllowLegacyTypeInTypeAttribute && isLegacySuppo rtedJavaScriptLanguage(type))) { 160 } else if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(type.stripWhiteSp ace()) || (supportLegacyTypes == AllowLegacyTypeInTypeAttribute && isLegacySuppo rtedJavaScriptLanguage(type))) {
159 return true; 161 return true;
160 } 162 }
161 163
162 return false; 164 return false;
163 } 165 }
164 166
165 // http://dev.w3.org/html5/spec/Overview.html#prepare-a-script 167 // http://dev.w3.org/html5/spec/Overview.html#prepare-a-script
166 ScriptPrep ScriptLoader::prepareScript(const TextPosition& scriptStartPosition, LegacyTypeSupport supportLegacyTypes) 168 bool ScriptLoader::prepareScript(const TextPosition& scriptStartPosition, Legacy TypeSupport supportLegacyTypes)
167 { 169 {
168 if (m_alreadyStarted) 170 if (m_alreadyStarted)
169 return ScriptPrep::failed(); 171 return false;
170 172
171 ScriptLoaderClient* client = this->client(); 173 ScriptLoaderClient* client = this->client();
172 174
173 bool wasParserInserted; 175 bool wasParserInserted;
174 if (m_parserInserted) { 176 if (m_parserInserted) {
175 wasParserInserted = true; 177 wasParserInserted = true;
176 m_parserInserted = false; 178 m_parserInserted = false;
177 } else { 179 } else {
178 wasParserInserted = false; 180 wasParserInserted = false;
179 } 181 }
180 182
181 if (wasParserInserted && !client->asyncAttributeValue()) 183 if (wasParserInserted && !client->asyncAttributeValue())
182 m_forceAsync = true; 184 m_forceAsync = true;
183 185
184 // FIXME: HTML5 spec says we should check that all children are either comme nts or empty text nodes. 186 // FIXME: HTML5 spec says we should check that all children are either comme nts or empty text nodes.
185 if (!client->hasSourceAttribute() && !m_element->firstChild()) 187 if (!client->hasSourceAttribute() && !m_element->firstChild())
186 return ScriptPrep::failed(); 188 return false;
187 189
188 if (!m_element->inDocument()) 190 if (!m_element->inDocument())
189 return ScriptPrep::failed(); 191 return false;
190 192
191 if (!isScriptTypeSupported(supportLegacyTypes)) 193 if (!isScriptTypeSupported(supportLegacyTypes))
192 return ScriptPrep::failed(); 194 return false;
193 195
194 if (wasParserInserted) { 196 if (wasParserInserted) {
195 m_parserInserted = true; 197 m_parserInserted = true;
196 m_forceAsync = false; 198 m_forceAsync = false;
197 } 199 }
198 200
199 m_alreadyStarted = true; 201 m_alreadyStarted = true;
200 202
201 // FIXME: If script is parser inserted, verify it's still in the original do cument. 203 // FIXME: If script is parser inserted, verify it's still in the original do cument.
202 Document& elementDocument = m_element->document(); 204 Document& elementDocument = m_element->document();
203 Document* contextDocument = elementDocument.contextDocument().get(); 205 Document* contextDocument = elementDocument.contextDocument().get();
204 206
205 if (!contextDocument || !contextDocument->allowExecutingScripts(m_element)) 207 if (!contextDocument || !contextDocument->allowExecutingScripts(m_element))
206 return ScriptPrep::failed(); 208 return false;
207 209
208 if (!isScriptForEventSupported()) 210 if (!isScriptForEventSupported())
209 return ScriptPrep::failed(); 211 return false;
210 212
211 if (!client->charsetAttributeValue().isEmpty()) 213 if (!client->charsetAttributeValue().isEmpty())
212 m_characterEncoding = client->charsetAttributeValue(); 214 m_characterEncoding = client->charsetAttributeValue();
213 else 215 else
214 m_characterEncoding = elementDocument.charset(); 216 m_characterEncoding = elementDocument.charset();
215 217
216 ResourcePtr<ScriptResource> resource;
217 if (client->hasSourceAttribute()) { 218 if (client->hasSourceAttribute()) {
218 resource = fetchScript(client->sourceAttributeValue()); 219 if (!fetchScript(client->sourceAttributeValue()))
219 if (!resource) { 220 return false;
220 dispatchErrorEvent();
221 return ScriptPrep::failed();
222 }
223
224 } 221 }
225 222
226 if (client->hasSourceAttribute() && client->deferAttributeValue() && m_parse rInserted && !client->asyncAttributeValue()) { 223 if (client->hasSourceAttribute() && client->deferAttributeValue() && m_parse rInserted && !client->asyncAttributeValue()) {
227 m_willExecuteWhenDocumentFinishedParsing = true; 224 m_willExecuteWhenDocumentFinishedParsing = true;
228 m_willBeParserExecuted = true; 225 m_willBeParserExecuted = true;
229 } else if (client->hasSourceAttribute() && m_parserInserted && !client->asyn cAttributeValue()) { 226 } else if (client->hasSourceAttribute() && m_parserInserted && !client->asyn cAttributeValue()) {
230 m_willBeParserExecuted = true; 227 m_willBeParserExecuted = true;
231 } else if (!client->hasSourceAttribute() && m_parserInserted && !elementDocu ment.isRenderingReady()) { 228 } else if (!client->hasSourceAttribute() && m_parserInserted && !elementDocu ment.isRenderingReady()) {
232 m_willBeParserExecuted = true; 229 m_willBeParserExecuted = true;
233 m_readyToBeParserExecuted = true; 230 m_readyToBeParserExecuted = true;
234 } else if (client->hasSourceAttribute() && !client->asyncAttributeValue() && !m_forceAsync) { 231 } else if (client->hasSourceAttribute() && !client->asyncAttributeValue() && !m_forceAsync) {
235 m_willExecuteInOrder = true; 232 m_willExecuteInOrder = true;
236 contextDocument->scriptRunner()->queueScriptForExecution(this, resource, ScriptRunner::IN_ORDER_EXECUTION); 233 contextDocument->scriptRunner()->queueScriptForExecution(this, m_resourc e, ScriptRunner::IN_ORDER_EXECUTION);
234 m_resource->addClient(this);
237 } else if (client->hasSourceAttribute()) { 235 } else if (client->hasSourceAttribute()) {
238 contextDocument->scriptRunner()->queueScriptForExecution(this, resource, ScriptRunner::ASYNC_EXECUTION); 236 contextDocument->scriptRunner()->queueScriptForExecution(this, m_resourc e, ScriptRunner::ASYNC_EXECUTION);
237 m_resource->addClient(this);
239 } else { 238 } else {
240 // Reset line numbering for nested writes. 239 // Reset line numbering for nested writes.
241 TextPosition position = elementDocument.isInDocumentWrite() ? TextPositi on() : scriptStartPosition; 240 TextPosition position = elementDocument.isInDocumentWrite() ? TextPositi on() : scriptStartPosition;
242 KURL scriptURL = (!elementDocument.isInDocumentWrite() && m_parserInsert ed) ? elementDocument.url() : KURL(); 241 KURL scriptURL = (!elementDocument.isInDocumentWrite() && m_parserInsert ed) ? elementDocument.url() : KURL();
243 executeScript(ScriptSourceCode(scriptContent(), scriptURL, position)); 242 executeScript(ScriptSourceCode(scriptContent(), scriptURL, position));
244 } 243 }
245 244
246 // FIXME: This second "subscribing" parameter is a mess. We shouldn't have t o need this. 245 return true;
247 if (resource)
248 setResource(resource, !m_willBeParserExecuted);
249
250 // We have to return fetchedResource instead of let callers ask ScriptLoader ::resource()
251 // because resource() can be null when it is accessed: Following setResource () can trigger clearResource().
252 return ScriptPrep(true, resource);
253 } 246 }
254 247
255 ResourcePtr<ScriptResource> ScriptLoader::fetchScript(const String& sourceUrl) 248 bool ScriptLoader::fetchScript(const String& sourceUrl)
256 { 249 {
257 ASSERT(m_element); 250 ASSERT(m_element);
258 251
259 RefPtrWillBeRawPtr<Document> elementDocument(m_element->document()); 252 RefPtrWillBeRawPtr<Document> elementDocument(m_element->document());
260 if (!m_element->inDocument() || m_element->document() != elementDocument) 253 if (!m_element->inDocument() || m_element->document() != elementDocument)
261 return ResourcePtr<ScriptResource>(); 254 return false;
262 255
263 ASSERT(!resource()); 256 ASSERT(!m_resource);
264 ResourcePtr<ScriptResource> resource;
265 if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) { 257 if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) {
266 FetchRequest request(ResourceRequest(elementDocument->completeURL(source Url)), m_element->localName()); 258 FetchRequest request(ResourceRequest(elementDocument->completeURL(source Url)), m_element->localName());
267 259
268 AtomicString crossOriginMode = m_element->fastGetAttribute(HTMLNames::cr ossoriginAttr); 260 AtomicString crossOriginMode = m_element->fastGetAttribute(HTMLNames::cr ossoriginAttr);
269 if (!crossOriginMode.isNull()) 261 if (!crossOriginMode.isNull())
270 request.setCrossOriginAccessControl(elementDocument->securityOrigin( ), crossOriginMode); 262 request.setCrossOriginAccessControl(elementDocument->securityOrigin( ), crossOriginMode);
271 request.setCharset(scriptCharset()); 263 request.setCharset(scriptCharset());
272 264
273 bool isValidScriptNonce = elementDocument->contentSecurityPolicy()->allo wScriptNonce(m_element->fastGetAttribute(HTMLNames::nonceAttr)); 265 bool isValidScriptNonce = elementDocument->contentSecurityPolicy()->allo wScriptNonce(m_element->fastGetAttribute(HTMLNames::nonceAttr));
274 if (isValidScriptNonce) 266 if (isValidScriptNonce)
275 request.setContentSecurityCheck(DoNotCheckContentSecurityPolicy); 267 request.setContentSecurityCheck(DoNotCheckContentSecurityPolicy);
276 268
277 resource = elementDocument->fetcher()->fetchScript(request); 269 m_resource = elementDocument->fetcher()->fetchScript(request);
278 m_isExternalScript = true; 270 m_isExternalScript = true;
279 } 271 }
280 272
281 return resource; 273 if (m_resource)
274 return true;
275
276 dispatchErrorEvent();
277 return false;
282 } 278 }
283 279
284 bool isHTMLScriptLoader(Element* element) 280 bool isHTMLScriptLoader(Element* element)
285 { 281 {
286 ASSERT(element); 282 ASSERT(element);
287 return isHTMLScriptElement(*element); 283 return isHTMLScriptElement(*element);
288 } 284 }
289 285
290 bool isSVGScriptLoader(Element* element) 286 bool isSVGScriptLoader(Element* element)
291 { 287 {
(...skipping 14 matching lines...) Expand all
306 return; 302 return;
307 303
308 LocalFrame* frame = contextDocument->frame(); 304 LocalFrame* frame = contextDocument->frame();
309 305
310 bool shouldBypassMainWorldContentSecurityPolicy = (frame && frame->script(). shouldBypassMainWorldContentSecurityPolicy()) || elementDocument->contentSecurit yPolicy()->allowScriptNonce(m_element->fastGetAttribute(HTMLNames::nonceAttr)) | | elementDocument->contentSecurityPolicy()->allowScriptHash(sourceCode.source()) ; 306 bool shouldBypassMainWorldContentSecurityPolicy = (frame && frame->script(). shouldBypassMainWorldContentSecurityPolicy()) || elementDocument->contentSecurit yPolicy()->allowScriptNonce(m_element->fastGetAttribute(HTMLNames::nonceAttr)) | | elementDocument->contentSecurityPolicy()->allowScriptHash(sourceCode.source()) ;
311 307
312 if (!m_isExternalScript && (!shouldBypassMainWorldContentSecurityPolicy && ! elementDocument->contentSecurityPolicy()->allowInlineScript(elementDocument->url (), m_startLineNumber))) 308 if (!m_isExternalScript && (!shouldBypassMainWorldContentSecurityPolicy && ! elementDocument->contentSecurityPolicy()->allowInlineScript(elementDocument->url (), m_startLineNumber)))
313 return; 309 return;
314 310
315 if (m_isExternalScript) { 311 if (m_isExternalScript) {
316 ScriptResource* resource = this->resource() ? this->resource() : sourceC ode.resource(); 312 ScriptResource* resource = m_resource ? m_resource.get() : sourceCode.re source();
317 if (resource && !resource->mimeTypeAllowedByNosniff()) { 313 if (resource && !resource->mimeTypeAllowedByNosniff()) {
318 contextDocument->addConsoleMessage(SecurityMessageSource, ErrorMessa geLevel, "Refused to execute script from '" + resource->url().elidedString() + " ' because its MIME type ('" + resource->mimeType() + "') is not executable, and strict MIME type checking is enabled."); 314 contextDocument->addConsoleMessage(SecurityMessageSource, ErrorMessa geLevel, "Refused to execute script from '" + resource->url().elidedString() + " ' because its MIME type ('" + resource->mimeType() + "') is not executable, and strict MIME type checking is enabled.");
319 return; 315 return;
320 } 316 }
321 } 317 }
322 318
323 if (frame) { 319 if (frame) {
324 const bool isImportedScript = contextDocument != elementDocument; 320 const bool isImportedScript = contextDocument != elementDocument;
325 // http://www.whatwg.org/specs/web-apps/current-work/#execute-the-script -block step 2.3 321 // http://www.whatwg.org/specs/web-apps/current-work/#execute-the-script -block step 2.3
326 // with additional support for HTML imports. 322 // with additional support for HTML imports.
(...skipping 11 matching lines...) Expand all
338 // Note: This is where the script is compiled and actually executed. 334 // Note: This is where the script is compiled and actually executed.
339 frame->script().executeScriptInMainWorld(sourceCode, corsCheck); 335 frame->script().executeScriptInMainWorld(sourceCode, corsCheck);
340 336
341 if (isHTMLScriptLoader(m_element)) { 337 if (isHTMLScriptLoader(m_element)) {
342 ASSERT(contextDocument->currentScript() == m_element); 338 ASSERT(contextDocument->currentScript() == m_element);
343 contextDocument->popCurrentScript(); 339 contextDocument->popCurrentScript();
344 } 340 }
345 } 341 }
346 } 342 }
347 343
344 void ScriptLoader::stopLoadRequest()
345 {
346 if (m_resource) {
347 if (!m_willBeParserExecuted)
348 m_resource->removeClient(this);
349 m_resource = 0;
350 }
351 }
352
348 void ScriptLoader::execute(ScriptResource* resource) 353 void ScriptLoader::execute(ScriptResource* resource)
349 { 354 {
350 ASSERT(!m_willBeParserExecuted); 355 ASSERT(!m_willBeParserExecuted);
351 ASSERT(resource); 356 ASSERT(resource);
352 if (resource->errorOccurred()) { 357 if (resource->errorOccurred()) {
353 dispatchErrorEvent(); 358 dispatchErrorEvent();
354 } else if (!resource->wasCanceled()) { 359 } else if (!resource->wasCanceled()) {
355 executeScript(ScriptSourceCode(resource)); 360 executeScript(ScriptSourceCode(resource));
356 dispatchLoadEvent(); 361 dispatchLoadEvent();
357 } 362 }
358 363 resource->removeClient(this);
359 clearResource();
360 } 364 }
361 365
362 void ScriptLoader::cancel(Document* contextDocument) 366 void ScriptLoader::cancel(Document* contextDocument)
363 { 367 {
364 if (!resource()) 368 if (!m_resource)
365 return; 369 return;
366 finishLoading(contextDocument, FinishWithCancel); 370 finishLoading(contextDocument, FinishWithCancel);
367 } 371 }
368 372
369 void ScriptLoader::notifyFinished(Resource* resource) 373 void ScriptLoader::notifyFinished(Resource* resource)
370 { 374 {
371 // Resource possibly invokes this notifyFinished() more than 375 // Resource possibly invokes this notifyFinished() more than
372 // once because ScriptLoader doesn't unsubscribe itself from 376 // once because ScriptLoader doesn't unsubscribe itself from
373 // Resource here and does it in execute() instead. 377 // Resource here and does it in execute() instead.
374 // We use resource() to check if this function is already called. 378 // We use m_resource to check if this function is already called.
375 ASSERT_UNUSED(resource, resource == this->resource()); 379 ASSERT_UNUSED(resource, resource == m_resource);
376 if (!this->resource()) 380 if (!m_resource)
377 return; 381 return;
378 382
379 RefPtr<Element> protect(m_element);
380 RefPtr<Document> elementDocument(m_element->document()); 383 RefPtr<Document> elementDocument(m_element->document());
381 RefPtr<Document> contextDocument = elementDocument->contextDocument().get(); 384 RefPtr<Document> contextDocument = elementDocument->contextDocument().get();
382 finishLoading(contextDocument.get(), resource->errorOccurred() ? FinishWithE rror : FinishSuccessfully); 385 finishLoading(contextDocument.get(), resource->errorOccurred() ? FinishWithE rror : FinishSuccessfully);
383 } 386 }
384 387
385 void ScriptLoader::finishLoading(Document* contextDocument, ScriptLoader::Finish Type type) 388 void ScriptLoader::finishLoading(Document* contextDocument, ScriptLoader::Finish Type type)
386 { 389 {
387 if (!m_willBeParserExecuted && contextDocument) 390 if (!contextDocument)
388 notifyRunnerFinishLoading(contextDocument->scriptRunner(), type); 391 return;
389 clearResource();
390 }
391 392
392 void ScriptLoader::notifyRunnerFinishLoading(ScriptRunner* runner, ScriptLoader: :FinishType type)
393 {
394 switch (type) { 393 switch (type) {
395 case FinishWithCancel: 394 case FinishWithCancel:
396 runner->notifyScriptLoadError(this, m_willExecuteInOrder ? ScriptRunner: :IN_ORDER_EXECUTION : ScriptRunner::ASYNC_EXECUTION); 395 if (!m_willBeParserExecuted)
396 contextDocument->scriptRunner()->notifyScriptLoadError(this, m_willE xecuteInOrder ? ScriptRunner::IN_ORDER_EXECUTION : ScriptRunner::ASYNC_EXECUTION );
397 stopLoadRequest();
397 break; 398 break;
398 case FinishWithError: 399 case FinishWithError:
400 ASSERT(!m_willBeParserExecuted);
399 dispatchErrorEvent(); 401 dispatchErrorEvent();
400 runner->notifyScriptLoadError(this, m_willExecuteInOrder ? ScriptRunner: :IN_ORDER_EXECUTION : ScriptRunner::ASYNC_EXECUTION); 402 contextDocument->scriptRunner()->notifyScriptLoadError(this, m_willExecu teInOrder ? ScriptRunner::IN_ORDER_EXECUTION : ScriptRunner::ASYNC_EXECUTION);
403 m_resource = 0;
401 break; 404 break;
402 case FinishSuccessfully: 405 case FinishSuccessfully:
403 runner->notifyScriptReady(this, m_willExecuteInOrder ? ScriptRunner::IN_ ORDER_EXECUTION : ScriptRunner::ASYNC_EXECUTION); 406 ASSERT(!m_willBeParserExecuted);
407 contextDocument->scriptRunner()->notifyScriptReady(this, m_willExecuteIn Order ? ScriptRunner::IN_ORDER_EXECUTION : ScriptRunner::ASYNC_EXECUTION);
408 m_resource = 0;
404 break; 409 break;
405 } 410 }
406 } 411 }
407 412
408
409 bool ScriptLoader::ignoresLoadRequest() const 413 bool ScriptLoader::ignoresLoadRequest() const
410 { 414 {
411 return m_alreadyStarted || m_isExternalScript || m_parserInserted || !elemen t() || !element()->inDocument(); 415 return m_alreadyStarted || m_isExternalScript || m_parserInserted || !elemen t() || !element()->inDocument();
412 } 416 }
413 417
414 bool ScriptLoader::isScriptForEventSupported() const 418 bool ScriptLoader::isScriptForEventSupported() const
415 { 419 {
416 String eventAttribute = client()->eventAttributeValue(); 420 String eventAttribute = client()->eventAttributeValue();
417 String forAttribute = client()->forAttributeValue(); 421 String forAttribute = client()->forAttributeValue();
418 if (!eventAttribute.isEmpty() && !forAttribute.isEmpty()) { 422 if (!eventAttribute.isEmpty() && !forAttribute.isEmpty()) {
(...skipping 30 matching lines...) Expand all
449 if (isHTMLScriptLoader(element)) 453 if (isHTMLScriptLoader(element))
450 return toHTMLScriptElement(element)->loader(); 454 return toHTMLScriptElement(element)->loader();
451 455
452 if (isSVGScriptLoader(element)) 456 if (isSVGScriptLoader(element))
453 return toSVGScriptElement(element)->loader(); 457 return toSVGScriptElement(element)->loader();
454 458
455 return 0; 459 return 0;
456 } 460 }
457 461
458 } 462 }
OLDNEW
« no previous file with comments | « trunk/Source/core/dom/ScriptLoader.h ('k') | trunk/Source/core/fetch/ResourceOwner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698