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

Side by Side Diff: Source/core/xml/parser/XMLDocumentParser.cpp

Issue 18226005: Do not fire beforeload events from frames with scripting disabled (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Do not fire events when the parser is stopped Created 7 years, 5 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/fast/images/image-beforeload-event-crash-expected.txt ('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) 2000 Peter Kelly (pmk@post.com) 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2008 Holger Hans Peter Freyther 7 * Copyright (C) 2008 Holger Hans Peter Freyther
8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 19 matching lines...) Expand all
30 #include <libxml/parserInternals.h> 30 #include <libxml/parserInternals.h>
31 #include <libxslt/xslt.h> 31 #include <libxslt/xslt.h>
32 #include <wtf/StringExtras.h> 32 #include <wtf/StringExtras.h>
33 #include <wtf/text/CString.h> 33 #include <wtf/text/CString.h>
34 #include <wtf/Threading.h> 34 #include <wtf/Threading.h>
35 #include <wtf/unicode/UTF8.h> 35 #include <wtf/unicode/UTF8.h>
36 #include <wtf/UnusedParam.h> 36 #include <wtf/UnusedParam.h>
37 #include <wtf/Vector.h> 37 #include <wtf/Vector.h>
38 #include "HTMLNames.h" 38 #include "HTMLNames.h"
39 #include "XMLNSNames.h" 39 #include "XMLNSNames.h"
40 #include "bindings/v8/ScriptController.h"
40 #include "bindings/v8/ScriptSourceCode.h" 41 #include "bindings/v8/ScriptSourceCode.h"
41 #include "core/dom/CDATASection.h" 42 #include "core/dom/CDATASection.h"
42 #include "core/dom/Comment.h" 43 #include "core/dom/Comment.h"
43 #include "core/dom/Document.h" 44 #include "core/dom/Document.h"
44 #include "core/dom/DocumentFragment.h" 45 #include "core/dom/DocumentFragment.h"
45 #include "core/dom/DocumentType.h" 46 #include "core/dom/DocumentType.h"
46 #include "core/dom/ExceptionCodePlaceholder.h" 47 #include "core/dom/ExceptionCodePlaceholder.h"
47 #include "core/dom/ProcessingInstruction.h" 48 #include "core/dom/ProcessingInstruction.h"
48 #include "core/dom/ScriptLoader.h" 49 #include "core/dom/ScriptLoader.h"
49 #include "core/dom/TransformSource.h" 50 #include "core/dom/TransformSource.h"
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 if (isStopped() || m_sawXSLTransform) 329 if (isStopped() || m_sawXSLTransform)
329 return; 330 return;
330 331
331 if (m_parserPaused) { 332 if (m_parserPaused) {
332 m_pendingSrc.append(source); 333 m_pendingSrc.append(source);
333 return; 334 return;
334 } 335 }
335 336
336 doWrite(source.toString()); 337 doWrite(source.toString());
337 338
338 // After parsing, go ahead and dispatch image beforeload events. 339 if (isStopped())
339 ImageLoader::dispatchPendingBeforeLoadEvents(); 340 return;
abarth-chromium 2013/07/10 21:33:08 LGTM
341
342 if (document()->frame() && document()->frame()->script()->canExecuteScripts( NotAboutToExecuteScript))
343 ImageLoader::dispatchPendingBeforeLoadEvents();
340 } 344 }
341 345
342 void XMLDocumentParser::handleError(XMLErrors::ErrorType type, const char* forma ttedMessage, TextPosition position) 346 void XMLDocumentParser::handleError(XMLErrors::ErrorType type, const char* forma ttedMessage, TextPosition position)
343 { 347 {
344 m_xmlErrors.handleError(type, formattedMessage, position); 348 m_xmlErrors.handleError(type, formattedMessage, position);
345 if (type != XMLErrors::warning) 349 if (type != XMLErrors::warning)
346 m_sawError = true; 350 m_sawError = true;
347 if (type == XMLErrors::fatal) 351 if (type == XMLErrors::fatal)
348 stopParsing(); 352 stopParsing();
349 } 353 }
(...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 sax.initialized = XML_SAX2_MAGIC; 1599 sax.initialized = XML_SAX2_MAGIC;
1596 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); 1600 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state);
1597 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1601 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />";
1598 parseChunk(parser->context(), parseString); 1602 parseChunk(parser->context(), parseString);
1599 finishParsing(parser->context()); 1603 finishParsing(parser->context());
1600 attrsOK = state.gotAttributes; 1604 attrsOK = state.gotAttributes;
1601 return state.attributes; 1605 return state.attributes;
1602 } 1606 }
1603 1607
1604 } // namespace WebCore 1608 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/images/image-beforeload-event-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698