| OLD | NEW |
| 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 int transferablesArgIndex = 2; | 271 int transferablesArgIndex = 2; |
| 272 if (isLegacyTargetOriginDesignation(info[2])) { | 272 if (isLegacyTargetOriginDesignation(info[2])) { |
| 273 targetOriginArgIndex = 2; | 273 targetOriginArgIndex = 2; |
| 274 transferablesArgIndex = 1; | 274 transferablesArgIndex = 1; |
| 275 } | 275 } |
| 276 if (!SerializedScriptValue::extractTransferables(info[transferablesArgIn
dex], transferablesArgIndex, portArray, arrayBufferArray, exceptionState, info.G
etIsolate())) { | 276 if (!SerializedScriptValue::extractTransferables(info[transferablesArgIn
dex], transferablesArgIndex, portArray, arrayBufferArray, exceptionState, info.G
etIsolate())) { |
| 277 exceptionState.throwIfNeeded(); | 277 exceptionState.throwIfNeeded(); |
| 278 return; | 278 return; |
| 279 } | 279 } |
| 280 } | 280 } |
| 281 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithUndefinedOrNullChe
ck>, targetOrigin, info[targetOriginArgIndex]); | 281 V8STRINGRESOURCE_PREPARE_VOID(V8StringResource<WithUndefinedOrNullCheck>, ta
rgetOrigin, info[targetOriginArgIndex]); |
| 282 | 282 |
| 283 RefPtr<SerializedScriptValue> message = SerializedScriptValue::create(info[0
], &portArray, &arrayBufferArray, exceptionState, info.GetIsolate()); | 283 RefPtr<SerializedScriptValue> message = SerializedScriptValue::create(info[0
], &portArray, &arrayBufferArray, exceptionState, info.GetIsolate()); |
| 284 if (exceptionState.throwIfNeeded()) | 284 if (exceptionState.throwIfNeeded()) |
| 285 return; | 285 return; |
| 286 | 286 |
| 287 window->postMessage(message.release(), &portArray, targetOrigin, source, exc
eptionState); | 287 window->postMessage(message.release(), &portArray, targetOrigin, source, exc
eptionState); |
| 288 exceptionState.throwIfNeeded(); | 288 exceptionState.throwIfNeeded(); |
| 289 } | 289 } |
| 290 | 290 |
| 291 // FIXME(fqian): returning string is cheating, and we should | 291 // FIXME(fqian): returning string is cheating, and we should |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 | 348 |
| 349 void V8Window::showModalDialogMethodCustom(const v8::FunctionCallbackInfo<v8::Va
lue>& info) | 349 void V8Window::showModalDialogMethodCustom(const v8::FunctionCallbackInfo<v8::Va
lue>& info) |
| 350 { | 350 { |
| 351 DOMWindow* impl = V8Window::toNative(info.Holder()); | 351 DOMWindow* impl = V8Window::toNative(info.Holder()); |
| 352 ExceptionState exceptionState(ExceptionState::ExecutionContext, "showModalDi
alog", "Window", info.Holder(), info.GetIsolate()); | 352 ExceptionState exceptionState(ExceptionState::ExecutionContext, "showModalDi
alog", "Window", info.Holder(), info.GetIsolate()); |
| 353 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), exceptionState)) { | 353 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), exceptionState)) { |
| 354 exceptionState.throwIfNeeded(); | 354 exceptionState.throwIfNeeded(); |
| 355 return; | 355 return; |
| 356 } | 356 } |
| 357 | 357 |
| 358 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithUndefinedOrNullChe
ck>, urlString, info[0]); | 358 V8STRINGRESOURCE_PREPARE_VOID(V8StringResource<WithUndefinedOrNullCheck>, ur
lString, info[0]); |
| 359 DialogHandler handler(info[1]); | 359 DialogHandler handler(info[1]); |
| 360 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithUndefinedOrNullChe
ck>, dialogFeaturesString, info[2]); | 360 V8STRINGRESOURCE_PREPARE_VOID(V8StringResource<WithUndefinedOrNullCheck>, di
alogFeaturesString, info[2]); |
| 361 | 361 |
| 362 impl->showModalDialog(urlString, dialogFeaturesString, callingDOMWindow(info
.GetIsolate()), enteredDOMWindow(info.GetIsolate()), setUpDialog, &handler); | 362 impl->showModalDialog(urlString, dialogFeaturesString, callingDOMWindow(info
.GetIsolate()), enteredDOMWindow(info.GetIsolate()), setUpDialog, &handler); |
| 363 | 363 |
| 364 v8SetReturnValue(info, handler.returnValue(info.GetIsolate())); | 364 v8SetReturnValue(info, handler.returnValue(info.GetIsolate())); |
| 365 } | 365 } |
| 366 | 366 |
| 367 void V8Window::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) | 367 void V8Window::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 368 { | 368 { |
| 369 DOMWindow* impl = V8Window::toNative(info.Holder()); | 369 DOMWindow* impl = V8Window::toNative(info.Holder()); |
| 370 ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "Win
dow", info.Holder(), info.GetIsolate()); | 370 ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "Win
dow", info.Holder(), info.GetIsolate()); |
| 371 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), exceptionState)) { | 371 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), exceptionState)) { |
| 372 exceptionState.throwIfNeeded(); | 372 exceptionState.throwIfNeeded(); |
| 373 return; | 373 return; |
| 374 } | 374 } |
| 375 | 375 |
| 376 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithUndefinedOrNullChe
ck>, urlString, info[0]); | 376 V8STRINGRESOURCE_PREPARE_VOID(V8StringResource<WithUndefinedOrNullCheck>, ur
lString, info[0]); |
| 377 AtomicString frameName; | 377 AtomicString frameName; |
| 378 if (info[1]->IsUndefined() || info[1]->IsNull()) { | 378 if (info[1]->IsUndefined() || info[1]->IsNull()) { |
| 379 frameName = "_blank"; | 379 frameName = "_blank"; |
| 380 } else { | 380 } else { |
| 381 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, frameNameResour
ce, info[1]); | 381 V8STRINGRESOURCE_PREPARE_VOID(V8StringResource<>, frameNameResource, inf
o[1]); |
| 382 frameName = frameNameResource; | 382 frameName = frameNameResource; |
| 383 } | 383 } |
| 384 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithUndefinedOrNullChe
ck>, windowFeaturesString, info[2]); | 384 V8STRINGRESOURCE_PREPARE_VOID(V8StringResource<WithUndefinedOrNullCheck>, wi
ndowFeaturesString, info[2]); |
| 385 | 385 |
| 386 RefPtrWillBeRawPtr<DOMWindow> openedWindow = impl->open(urlString, frameName
, windowFeaturesString, callingDOMWindow(info.GetIsolate()), enteredDOMWindow(in
fo.GetIsolate())); | 386 RefPtrWillBeRawPtr<DOMWindow> openedWindow = impl->open(urlString, frameName
, windowFeaturesString, callingDOMWindow(info.GetIsolate()), enteredDOMWindow(in
fo.GetIsolate())); |
| 387 if (!openedWindow) | 387 if (!openedWindow) |
| 388 return; | 388 return; |
| 389 | 389 |
| 390 v8SetReturnValueFast(info, openedWindow.release(), impl); | 390 v8SetReturnValueFast(info, openedWindow.release(), impl); |
| 391 } | 391 } |
| 392 | 392 |
| 393 void V8Window::namedPropertyGetterCustom(v8::Local<v8::String> name, const v8::P
ropertyCallbackInfo<v8::Value>& info) | 393 void V8Window::namedPropertyGetterCustom(v8::Local<v8::String> name, const v8::P
ropertyCallbackInfo<v8::Value>& info) |
| 394 { | 394 { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 v8::Handle<v8::Context> context = toV8Context(isolate, frame, DOMWrapperWorl
d::current(isolate)); | 553 v8::Handle<v8::Context> context = toV8Context(isolate, frame, DOMWrapperWorl
d::current(isolate)); |
| 554 if (context.IsEmpty()) | 554 if (context.IsEmpty()) |
| 555 return v8Undefined(); | 555 return v8Undefined(); |
| 556 | 556 |
| 557 v8::Handle<v8::Object> global = context->Global(); | 557 v8::Handle<v8::Object> global = context->Global(); |
| 558 ASSERT(!global.IsEmpty()); | 558 ASSERT(!global.IsEmpty()); |
| 559 return global; | 559 return global; |
| 560 } | 560 } |
| 561 | 561 |
| 562 } // namespace WebCore | 562 } // namespace WebCore |
| OLD | NEW |