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

Side by Side Diff: Source/bindings/v8/custom/V8WindowCustom.cpp

Issue 303363002: Fix toV8 and 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/custom/V8InjectedScriptHostCustom.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, 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2011 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 DOMWindow* impl = V8Window::toNative(info.Holder()); 180 DOMWindow* impl = V8Window::toNative(info.Holder());
181 ExceptionState exceptionState(ExceptionState::GetterContext, "frame", "Windo w", info.Holder(), info.GetIsolate()); 181 ExceptionState exceptionState(ExceptionState::GetterContext, "frame", "Windo w", info.Holder(), info.GetIsolate());
182 if (!BindingSecurity::shouldAllowAccessToNode(info.GetIsolate(), impl->frame Element(), exceptionState)) { 182 if (!BindingSecurity::shouldAllowAccessToNode(info.GetIsolate(), impl->frame Element(), exceptionState)) {
183 v8SetReturnValueNull(info); 183 v8SetReturnValueNull(info);
184 exceptionState.throwIfNeeded(); 184 exceptionState.throwIfNeeded();
185 return; 185 return;
186 } 186 }
187 187
188 // The wrapper for an <iframe> should get its prototype from the context of the frame it's in, rather than its own frame. 188 // The wrapper for an <iframe> should get its prototype from the context of the frame it's in, rather than its own frame.
189 // So, use its containing document as the creation context when wrapping. 189 // So, use its containing document as the creation context when wrapping.
190 v8::Handle<v8::Value> creationContext = toV8(&impl->frameElement()->document (), v8::Handle<v8::Object>(), info.GetIsolate()); 190 v8::Handle<v8::Value> creationContext = toV8(&impl->frameElement()->document (), info.Holder(), info.GetIsolate());
191 RELEASE_ASSERT(!creationContext.IsEmpty()); 191 RELEASE_ASSERT(!creationContext.IsEmpty());
192 v8::Handle<v8::Value> wrapper = toV8(impl->frameElement(), v8::Handle<v8::Ob ject>::Cast(creationContext), info.GetIsolate()); 192 v8::Handle<v8::Value> wrapper = toV8(impl->frameElement(), v8::Handle<v8::Ob ject>::Cast(creationContext), info.GetIsolate());
193 v8SetReturnValue(info, wrapper); 193 v8SetReturnValue(info, wrapper);
194 } 194 }
195 195
196 void V8Window::openerAttributeSetterCustom(v8::Local<v8::Value> value, const v8: :PropertyCallbackInfo<void>& info) 196 void V8Window::openerAttributeSetterCustom(v8::Local<v8::Value> value, const v8: :PropertyCallbackInfo<void>& info)
197 { 197 {
198 DOMWindow* impl = V8Window::toNative(info.Holder()); 198 DOMWindow* impl = V8Window::toNative(info.Holder());
199 ExceptionState exceptionState(ExceptionState::SetterContext, "opener", "Wind ow", info.Holder(), info.GetIsolate()); 199 ExceptionState exceptionState(ExceptionState::SetterContext, "opener", "Wind ow", info.Holder(), info.GetIsolate());
200 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram e(), exceptionState)) { 200 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram e(), exceptionState)) {
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 v8::Handle<v8::Context> context = toV8Context(isolate, frame, DOMWrapperWorl d::current(isolate)); 533 v8::Handle<v8::Context> context = toV8Context(isolate, frame, DOMWrapperWorl d::current(isolate));
534 if (context.IsEmpty()) 534 if (context.IsEmpty())
535 return v8Undefined(); 535 return v8Undefined();
536 536
537 v8::Handle<v8::Object> global = context->Global(); 537 v8::Handle<v8::Object> global = context->Global();
538 ASSERT(!global.IsEmpty()); 538 ASSERT(!global.IsEmpty());
539 return global; 539 return global;
540 } 540 }
541 541
542 } // namespace WebCore 542 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698