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

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

Issue 1305213005: Correct handling of |for| and |event| attributes of script elements. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 | « LayoutTests/TestExpectations ('k') | no next file » | 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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 475
476 bool ScriptLoader::ignoresLoadRequest() const 476 bool ScriptLoader::ignoresLoadRequest() const
477 { 477 {
478 return m_alreadyStarted || m_isExternalScript || m_parserInserted || !elemen t() || !element()->inDocument(); 478 return m_alreadyStarted || m_isExternalScript || m_parserInserted || !elemen t() || !element()->inDocument();
479 } 479 }
480 480
481 bool ScriptLoader::isScriptForEventSupported() const 481 bool ScriptLoader::isScriptForEventSupported() const
482 { 482 {
483 String eventAttribute = client()->eventAttributeValue(); 483 String eventAttribute = client()->eventAttributeValue();
484 String forAttribute = client()->forAttributeValue(); 484 String forAttribute = client()->forAttributeValue();
485 if (!eventAttribute.isEmpty() && !forAttribute.isEmpty()) { 485 if (eventAttribute.isNull() || forAttribute.isNull())
tkent 2015/09/02 07:37:31 This change might look complex, but it's - Replac
kochi 2015/09/02 07:47:07 Acknowledged.
486 forAttribute = forAttribute.stripWhiteSpace(); 486 return true;
487 if (!equalIgnoringCase(forAttribute, "window"))
488 return false;
489 487
490 eventAttribute = eventAttribute.stripWhiteSpace(); 488 forAttribute = forAttribute.stripWhiteSpace();
491 if (!equalIgnoringCase(eventAttribute, "onload") && !equalIgnoringCase(e ventAttribute, "onload()")) 489 if (!equalIgnoringCase(forAttribute, "window"))
492 return false; 490 return false;
493 } 491 eventAttribute = eventAttribute.stripWhiteSpace();
494 return true; 492 return equalIgnoringCase(eventAttribute, "onload") || equalIgnoringCase(even tAttribute, "onload()");
495 } 493 }
496 494
497 String ScriptLoader::scriptContent() const 495 String ScriptLoader::scriptContent() const
498 { 496 {
499 return m_element->textFromChildren(); 497 return m_element->textFromChildren();
500 } 498 }
501 499
502 ScriptLoaderClient* ScriptLoader::client() const 500 ScriptLoaderClient* ScriptLoader::client() const
503 { 501 {
504 if (isHTMLScriptLoader(m_element)) 502 if (isHTMLScriptLoader(m_element))
(...skipping 11 matching lines...) Expand all
516 if (isHTMLScriptLoader(element)) 514 if (isHTMLScriptLoader(element))
517 return toHTMLScriptElement(element)->loader(); 515 return toHTMLScriptElement(element)->loader();
518 516
519 if (isSVGScriptLoader(element)) 517 if (isSVGScriptLoader(element))
520 return toSVGScriptElement(element)->loader(); 518 return toSVGScriptElement(element)->loader();
521 519
522 return 0; 520 return 0;
523 } 521 }
524 522
525 } // namespace blink 523 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698