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

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

Issue 298863010: Oilpan: have PendingScripts trace their script elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Trace HTMLScriptRunnerHost from HTMLScriptRunner Created 6 years, 6 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
« no previous file with comments | « Source/core/dom/PendingScript.cpp ('k') | Source/core/dom/ScriptRunner.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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 return isSVGScriptElement(*element); 289 return isSVGScriptElement(*element);
290 } 290 }
291 291
292 void ScriptLoader::executeScript(const ScriptSourceCode& sourceCode) 292 void ScriptLoader::executeScript(const ScriptSourceCode& sourceCode)
293 { 293 {
294 ASSERT(m_alreadyStarted); 294 ASSERT(m_alreadyStarted);
295 295
296 if (sourceCode.isEmpty()) 296 if (sourceCode.isEmpty())
297 return; 297 return;
298 298
299 RefPtr<Document> elementDocument(m_element->document()); 299 RefPtrWillBeRawPtr<Document> elementDocument(m_element->document());
300 RefPtr<Document> contextDocument = elementDocument->contextDocument().get(); 300 RefPtrWillBeRawPtr<Document> contextDocument = elementDocument->contextDocum ent().get();
301 if (!contextDocument) 301 if (!contextDocument)
302 return; 302 return;
303 303
304 LocalFrame* frame = contextDocument->frame(); 304 LocalFrame* frame = contextDocument->frame();
305 305
306 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()) ;
307 307
308 if (!m_isExternalScript && (!shouldBypassMainWorldContentSecurityPolicy && ! elementDocument->contentSecurityPolicy()->allowInlineScript(elementDocument->url (), m_startLineNumber))) 308 if (!m_isExternalScript && (!shouldBypassMainWorldContentSecurityPolicy && ! elementDocument->contentSecurityPolicy()->allowInlineScript(elementDocument->url (), m_startLineNumber)))
309 return; 309 return;
310 310
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 executeScript(ScriptSourceCode(resource)); 360 executeScript(ScriptSourceCode(resource));
361 dispatchLoadEvent(); 361 dispatchLoadEvent();
362 } 362 }
363 resource->removeClient(this); 363 resource->removeClient(this);
364 } 364 }
365 365
366 void ScriptLoader::notifyFinished(Resource* resource) 366 void ScriptLoader::notifyFinished(Resource* resource)
367 { 367 {
368 ASSERT(!m_willBeParserExecuted); 368 ASSERT(!m_willBeParserExecuted);
369 369
370 RefPtr<Document> elementDocument(m_element->document()); 370 RefPtrWillBeRawPtr<Document> elementDocument(m_element->document());
371 RefPtr<Document> contextDocument = elementDocument->contextDocument().get(); 371 RefPtrWillBeRawPtr<Document> contextDocument = elementDocument->contextDocum ent().get();
372 if (!contextDocument) 372 if (!contextDocument)
373 return; 373 return;
374 374
375 // Resource possibly invokes this notifyFinished() more than 375 // Resource possibly invokes this notifyFinished() more than
376 // once because ScriptLoader doesn't unsubscribe itself from 376 // once because ScriptLoader doesn't unsubscribe itself from
377 // Resource here and does it in execute() instead. 377 // Resource here and does it in execute() instead.
378 // We use m_resource to check if this function is already called. 378 // We use m_resource to check if this function is already called.
379 ASSERT_UNUSED(resource, resource == m_resource); 379 ASSERT_UNUSED(resource, resource == m_resource);
380 if (!m_resource) 380 if (!m_resource)
381 return; 381 return;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 if (isHTMLScriptLoader(element)) 435 if (isHTMLScriptLoader(element))
436 return toHTMLScriptElement(element)->loader(); 436 return toHTMLScriptElement(element)->loader();
437 437
438 if (isSVGScriptLoader(element)) 438 if (isSVGScriptLoader(element))
439 return toSVGScriptElement(element)->loader(); 439 return toSVGScriptElement(element)->loader();
440 440
441 return 0; 441 return 0;
442 } 442 }
443 443
444 } 444 }
OLDNEW
« no previous file with comments | « Source/core/dom/PendingScript.cpp ('k') | Source/core/dom/ScriptRunner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698