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

Side by Side Diff: Source/bindings/v8/V8Initializer.cpp

Issue 311733003: Fix ExceptionState with empty context. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | « Source/bindings/v8/ExceptionState.cpp ('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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, v8 ::AccessType type, v8::Local<v8::Value> data) 135 static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, v8 ::AccessType type, v8::Local<v8::Value> data)
136 { 136 {
137 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 137 v8::Isolate* isolate = v8::Isolate::GetCurrent();
138 LocalFrame* target = findFrame(host, data, isolate); 138 LocalFrame* target = findFrame(host, data, isolate);
139 if (!target) 139 if (!target)
140 return; 140 return;
141 DOMWindow* targetWindow = target->domWindow(); 141 DOMWindow* targetWindow = target->domWindow();
142 142
143 // FIXME: We should modify V8 to pass in more contextual information (contex t, property, and object). 143 // FIXME: We should modify V8 to pass in more contextual information (contex t, property, and object).
144 ExceptionState exceptionState(ExceptionState::UnknownContext, 0, 0, v8::Hand le<v8::Object>(), isolate); 144 ExceptionState exceptionState(ExceptionState::UnknownContext, 0, 0, isolate- >GetCurrentContext()->Global(), isolate);
145 exceptionState.throwSecurityError(targetWindow->sanitizedCrossDomainAccessEr rorMessage(callingDOMWindow(isolate)), targetWindow->crossDomainAccessErrorMessa ge(callingDOMWindow(isolate))); 145 exceptionState.throwSecurityError(targetWindow->sanitizedCrossDomainAccessEr rorMessage(callingDOMWindow(isolate)), targetWindow->crossDomainAccessErrorMessa ge(callingDOMWindow(isolate)));
146 exceptionState.throwIfNeeded(); 146 exceptionState.throwIfNeeded();
147 } 147 }
148 148
149 static bool codeGenerationCheckCallbackInMainThread(v8::Local<v8::Context> conte xt) 149 static bool codeGenerationCheckCallbackInMainThread(v8::Local<v8::Context> conte xt)
150 { 150 {
151 if (ExecutionContext* executionContext = toExecutionContext(context)) { 151 if (ExecutionContext* executionContext = toExecutionContext(context)) {
152 if (ContentSecurityPolicy* policy = toDocument(executionContext)->conten tSecurityPolicy()) 152 if (ContentSecurityPolicy* policy = toDocument(executionContext)->conten tSecurityPolicy())
153 return policy->allowEval(ScriptState::from(context)); 153 return policy->allowEval(ScriptState::from(context));
154 } 154 }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 v8::V8::AddMessageListener(messageHandlerInWorker); 240 v8::V8::AddMessageListener(messageHandlerInWorker);
241 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); 241 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker);
242 242
243 v8::ResourceConstraints resourceConstraints; 243 v8::ResourceConstraints resourceConstraints;
244 uint32_t here; 244 uint32_t here;
245 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin t32_t*)); 245 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin t32_t*));
246 v8::SetResourceConstraints(isolate, &resourceConstraints); 246 v8::SetResourceConstraints(isolate, &resourceConstraints);
247 } 247 }
248 248
249 } // namespace WebCore 249 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/ExceptionState.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698