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

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

Issue 683013002: Extract a DOMWindow interface from LocalDOMWindow and use it in the idl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on top of DOMWindow moves and UseCounter overload for Frame Created 6 years, 1 month 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
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "platform/TraceEvent.h" 54 #include "platform/TraceEvent.h"
55 #include "platform/scheduler/Scheduler.h" 55 #include "platform/scheduler/Scheduler.h"
56 #include "public/platform/Platform.h" 56 #include "public/platform/Platform.h"
57 #include "wtf/RefPtr.h" 57 #include "wtf/RefPtr.h"
58 #include "wtf/ThreadSpecific.h" 58 #include "wtf/ThreadSpecific.h"
59 #include "wtf/text/WTFString.h" 59 #include "wtf/text/WTFString.h"
60 #include <v8-debug.h> 60 #include <v8-debug.h>
61 61
62 namespace blink { 62 namespace blink {
63 63
64 static LocalFrame* findFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> da ta, v8::Isolate* isolate) 64 static Frame* findFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> data, v 8::Isolate* isolate)
65 { 65 {
66 const WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data); 66 const WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data);
67 67
68 if (V8Window::wrapperTypeInfo.equals(type)) { 68 if (V8Window::wrapperTypeInfo.equals(type)) {
69 v8::Handle<v8::Object> windowWrapper = V8Window::findInstanceInPrototype Chain(host, isolate); 69 v8::Handle<v8::Object> windowWrapper = V8Window::findInstanceInPrototype Chain(host, isolate);
70 if (windowWrapper.IsEmpty()) 70 if (windowWrapper.IsEmpty())
71 return 0; 71 return 0;
72 return V8Window::toImpl(windowWrapper)->frame(); 72 return V8Window::toImpl(windowWrapper)->frame();
73 } 73 }
74 74
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) 291 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0)
292 callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallSt ackSizeToCapture, isolate); 292 callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallSt ackSizeToCapture, isolate);
293 293
294 ScriptState* scriptState = ScriptState::from(context); 294 ScriptState* scriptState = ScriptState::from(context);
295 promiseRejectMessageQueue().append(PromiseRejectMessage(ScriptValue(scriptSt ate, promise), callStack)); 295 promiseRejectMessageQueue().append(PromiseRejectMessage(ScriptValue(scriptSt ate, promise), callStack));
296 } 296 }
297 297
298 static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, v8 ::AccessType type, v8::Local<v8::Value> data) 298 static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, v8 ::AccessType type, v8::Local<v8::Value> data)
299 { 299 {
300 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 300 v8::Isolate* isolate = v8::Isolate::GetCurrent();
301 LocalFrame* target = findFrame(host, data, isolate); 301 Frame* target = findFrame(host, data, isolate);
302 if (!target) 302 if (!target)
303 return; 303 return;
304 LocalDOMWindow* targetWindow = target->domWindow(); 304 DOMWindow* targetWindow = target->domWindow();
305 305
306 // FIXME: We should modify V8 to pass in more contextual information (contex t, property, and object). 306 // FIXME: We should modify V8 to pass in more contextual information (contex t, property, and object).
307 ExceptionState exceptionState(ExceptionState::UnknownContext, 0, 0, isolate- >GetCurrentContext()->Global(), isolate); 307 ExceptionState exceptionState(ExceptionState::UnknownContext, 0, 0, isolate- >GetCurrentContext()->Global(), isolate);
308 exceptionState.throwSecurityError(targetWindow->sanitizedCrossDomainAccessEr rorMessage(callingDOMWindow(isolate)), targetWindow->crossDomainAccessErrorMessa ge(callingDOMWindow(isolate))); 308 exceptionState.throwSecurityError(targetWindow->sanitizedCrossDomainAccessEr rorMessage(callingDOMWindow(isolate)), targetWindow->crossDomainAccessErrorMessa ge(callingDOMWindow(isolate)));
309 exceptionState.throwIfNeeded(); 309 exceptionState.throwIfNeeded();
310 } 310 }
311 311
312 static bool codeGenerationCheckCallbackInMainThread(v8::Local<v8::Context> conte xt) 312 static bool codeGenerationCheckCallbackInMainThread(v8::Local<v8::Context> conte xt)
313 { 313 {
314 if (ExecutionContext* executionContext = toExecutionContext(context)) { 314 if (ExecutionContext* executionContext = toExecutionContext(context)) {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 435
436 v8::V8::AddMessageListener(messageHandlerInWorker); 436 v8::V8::AddMessageListener(messageHandlerInWorker);
437 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); 437 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker);
438 438
439 uint32_t here; 439 uint32_t here;
440 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi ze / sizeof(uint32_t*))); 440 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi ze / sizeof(uint32_t*)));
441 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); 441 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker);
442 } 442 }
443 443
444 } // namespace blink 444 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698