| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |