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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/DocumentWriteEvaluator.cpp

Issue 2817533003: Replace ASSERT, RELEASE_ASSERT, and ASSERT_NOT_REACHED in bindings (Closed)
Patch Set: fixed dcheck build error Created 3 years, 8 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "bindings/core/v8/DocumentWriteEvaluator.h" 5 #include "bindings/core/v8/DocumentWriteEvaluator.h"
6 6
7 #include "bindings/core/v8/ScriptSourceCode.h" 7 #include "bindings/core/v8/ScriptSourceCode.h"
8 #include "bindings/core/v8/V8BindingMacros.h" 8 #include "bindings/core/v8/V8BindingMacros.h"
9 #include "bindings/core/v8/V8ScriptRunner.h" 9 #include "bindings/core/v8/V8ScriptRunner.h"
10 #include "core/frame/Location.h" 10 #include "core/frame/Location.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // targets for evaluation, their data is vulnerable. E.g. 66 // targets for evaluation, their data is vulnerable. E.g.
67 // Origin B: 67 // Origin B:
68 // <script> 68 // <script>
69 // var userData = [<secret data>, <more secret data>]; 69 // var userData = [<secret data>, <more secret data>];
70 // document.write("<script src='/postData/'"+String(userData)+"' />"); 70 // document.write("<script src='/postData/'"+String(userData)+"' />");
71 // </script> 71 // </script>
72 bool DocumentWriteEvaluator::EnsureEvaluationContext() { 72 bool DocumentWriteEvaluator::EnsureEvaluationContext() {
73 if (!persistent_context_.IsEmpty()) 73 if (!persistent_context_.IsEmpty())
74 return false; 74 return false;
75 TRACE_EVENT0("blink", "DocumentWriteEvaluator::initializeEvaluationContext"); 75 TRACE_EVENT0("blink", "DocumentWriteEvaluator::initializeEvaluationContext");
76 ASSERT(persistent_context_.IsEmpty()); 76 DCHECK(persistent_context_.IsEmpty());
77 v8::Isolate* isolate = V8PerIsolateData::MainThreadIsolate(); 77 v8::Isolate* isolate = V8PerIsolateData::MainThreadIsolate();
78 v8::Isolate::Scope isolate_scope(isolate); 78 v8::Isolate::Scope isolate_scope(isolate);
79 v8::HandleScope handle_scope(isolate); 79 v8::HandleScope handle_scope(isolate);
80 v8::Local<v8::Context> context = v8::Context::New(isolate); 80 v8::Local<v8::Context> context = v8::Context::New(isolate);
81 persistent_context_.Set(isolate, context); 81 persistent_context_.Set(isolate, context);
82 v8::Context::Scope context_scope(context); 82 v8::Context::Scope context_scope(context);
83 83
84 // Initialize global objects. 84 // Initialize global objects.
85 window_.Set(isolate, v8::Object::New(isolate)); 85 window_.Set(isolate, v8::Object::New(isolate));
86 location_.Set(isolate, v8::Object::New(isolate)); 86 location_.Set(isolate, v8::Object::New(isolate));
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 Evaluate(script_source); 160 Evaluate(script_source);
161 return document_written_strings_.ToString(); 161 return document_written_strings_.ToString();
162 } 162 }
163 163
164 void DocumentWriteEvaluator::RecordDocumentWrite( 164 void DocumentWriteEvaluator::RecordDocumentWrite(
165 const String& document_written_string) { 165 const String& document_written_string) {
166 document_written_strings_.Append(document_written_string); 166 document_written_strings_.Append(document_written_string);
167 } 167 }
168 168
169 } // namespace blink 169 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698