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

Unified Diff: third_party/WebKit/Source/core/testing/Internals.cpp

Issue 2461633002: Missing document null pointer check in Internals. (Closed)
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/harness/internals-no-document-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/testing/Internals.cpp
diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp
index 516e77e6cae6eb43cd98e2da9b08250c461bee79..34bf1b830912ff027d8882feafa153da6434f8de 100644
--- a/third_party/WebKit/Source/core/testing/Internals.cpp
+++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -2293,14 +2293,16 @@ void Internals::stopTrackingRepaints(Document* document,
void Internals::updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(
Node* node,
ExceptionState& exceptionState) {
- Document* document;
+ Document* document = nullptr;
if (!node) {
document = contextDocument();
} else if (node->isDocumentNode()) {
document = toDocument(node);
} else if (isHTMLIFrameElement(*node)) {
document = toHTMLIFrameElement(*node).contentDocument();
- } else {
+ }
+
+ if (!document) {
exceptionState.throwTypeError(
"The node provided is neither a document nor an IFrame.");
return;
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/harness/internals-no-document-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698