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

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

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

Powered by Google App Engine
This is Rietveld 408576698