Chromium Code Reviews| 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 | 274 |
| 275 if (m_resource) | 275 if (m_resource) |
| 276 return true; | 276 return true; |
| 277 | 277 |
| 278 dispatchErrorEvent(); | 278 dispatchErrorEvent(); |
| 279 return false; | 279 return false; |
| 280 } | 280 } |
| 281 | 281 |
| 282 bool isHTMLScriptLoader(Element* element) | 282 bool isHTMLScriptLoader(Element* element) |
| 283 { | 283 { |
| 284 return element->hasTagName(HTMLNames::scriptTag); | 284 ASSERT(element); |
| 285 return isHTMLScriptElement(*element); | |
|
eseidel
2014/03/10 18:17:01
Won't dereferencing null on the next line crash ju
Inactive
2014/03/10 18:21:54
I would prefer hitting an assertion than actually
| |
| 285 } | 286 } |
| 286 | 287 |
| 287 bool isSVGScriptLoader(Element* element) | 288 bool isSVGScriptLoader(Element* element) |
| 288 { | 289 { |
| 289 return element->hasTagName(SVGNames::scriptTag); | 290 ASSERT(element); |
| 291 return isSVGScriptElement(*element); | |
| 290 } | 292 } |
| 291 | 293 |
| 292 void ScriptLoader::executeScript(const ScriptSourceCode& sourceCode) | 294 void ScriptLoader::executeScript(const ScriptSourceCode& sourceCode) |
| 293 { | 295 { |
| 294 ASSERT(m_alreadyStarted); | 296 ASSERT(m_alreadyStarted); |
| 295 | 297 |
| 296 if (sourceCode.isEmpty()) | 298 if (sourceCode.isEmpty()) |
| 297 return; | 299 return; |
| 298 | 300 |
| 299 RefPtr<Document> elementDocument(m_element->document()); | 301 RefPtr<Document> elementDocument(m_element->document()); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 435 if (isHTMLScriptLoader(element)) | 437 if (isHTMLScriptLoader(element)) |
| 436 return toHTMLScriptElement(element)->loader(); | 438 return toHTMLScriptElement(element)->loader(); |
| 437 | 439 |
| 438 if (isSVGScriptLoader(element)) | 440 if (isSVGScriptLoader(element)) |
| 439 return toSVGScriptElement(element)->loader(); | 441 return toSVGScriptElement(element)->loader(); |
| 440 | 442 |
| 441 return 0; | 443 return 0; |
| 442 } | 444 } |
| 443 | 445 |
| 444 } | 446 } |
| OLD | NEW |