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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 int transferablesArgIndex = 2; | 257 int transferablesArgIndex = 2; |
258 if (isLegacyTargetOriginDesignation(info[2])) { | 258 if (isLegacyTargetOriginDesignation(info[2])) { |
259 targetOriginArgIndex = 2; | 259 targetOriginArgIndex = 2; |
260 transferablesArgIndex = 1; | 260 transferablesArgIndex = 1; |
261 } | 261 } |
262 if (!SerializedScriptValue::extractTransferables(info[transferablesArgIn
dex], transferablesArgIndex, portArray, arrayBufferArray, exceptionState, info.G
etIsolate())) { | 262 if (!SerializedScriptValue::extractTransferables(info[transferablesArgIn
dex], transferablesArgIndex, portArray, arrayBufferArray, exceptionState, info.G
etIsolate())) { |
263 exceptionState.throwIfNeeded(); | 263 exceptionState.throwIfNeeded(); |
264 return; | 264 return; |
265 } | 265 } |
266 } | 266 } |
267 TOSTRING_VOID(V8StringResource<WithUndefinedOrNullCheck>, targetOrigin, info
[targetOriginArgIndex]); | 267 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, targetOri
gin, info[targetOriginArgIndex]); |
268 | 268 |
269 RefPtr<SerializedScriptValue> message = SerializedScriptValue::create(info[0
], &portArray, &arrayBufferArray, exceptionState, info.GetIsolate()); | 269 RefPtr<SerializedScriptValue> message = SerializedScriptValue::create(info[0
], &portArray, &arrayBufferArray, exceptionState, info.GetIsolate()); |
270 if (exceptionState.throwIfNeeded()) | 270 if (exceptionState.throwIfNeeded()) |
271 return; | 271 return; |
272 | 272 |
273 window->postMessage(message.release(), &portArray, targetOrigin, source, exc
eptionState); | 273 window->postMessage(message.release(), &portArray, targetOrigin, source, exc
eptionState); |
274 exceptionState.throwIfNeeded(); | 274 exceptionState.throwIfNeeded(); |
275 } | 275 } |
276 | 276 |
277 // FIXME(fqian): returning string is cheating, and we should | 277 // FIXME(fqian): returning string is cheating, and we should |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 | 340 |
341 void V8Window::showModalDialogMethodCustom(const v8::FunctionCallbackInfo<v8::Va
lue>& info) | 341 void V8Window::showModalDialogMethodCustom(const v8::FunctionCallbackInfo<v8::Va
lue>& info) |
342 { | 342 { |
343 LocalDOMWindow* impl = V8Window::toNative(info.Holder()); | 343 LocalDOMWindow* impl = V8Window::toNative(info.Holder()); |
344 ExceptionState exceptionState(ExceptionState::ExecutionContext, "showModalDi
alog", "Window", info.Holder(), info.GetIsolate()); | 344 ExceptionState exceptionState(ExceptionState::ExecutionContext, "showModalDi
alog", "Window", info.Holder(), info.GetIsolate()); |
345 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), exceptionState)) { | 345 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), exceptionState)) { |
346 exceptionState.throwIfNeeded(); | 346 exceptionState.throwIfNeeded(); |
347 return; | 347 return; |
348 } | 348 } |
349 | 349 |
350 TOSTRING_VOID(V8StringResource<WithUndefinedOrNullCheck>, urlString, info[0]
); | 350 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, urlString
, info[0]); |
351 DialogHandler handler(info[1], ScriptState::current(info.GetIsolate())); | 351 DialogHandler handler(info[1], ScriptState::current(info.GetIsolate())); |
352 TOSTRING_VOID(V8StringResource<WithUndefinedOrNullCheck>, dialogFeaturesStri
ng, info[2]); | 352 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, dialogFea
turesString, info[2]); |
353 | 353 |
354 impl->showModalDialog(urlString, dialogFeaturesString, callingDOMWindow(info
.GetIsolate()), enteredDOMWindow(info.GetIsolate()), setUpDialog, &handler); | 354 impl->showModalDialog(urlString, dialogFeaturesString, callingDOMWindow(info
.GetIsolate()), enteredDOMWindow(info.GetIsolate()), setUpDialog, &handler); |
355 | 355 |
356 v8SetReturnValue(info, handler.returnValue()); | 356 v8SetReturnValue(info, handler.returnValue()); |
357 } | 357 } |
358 | 358 |
359 void V8Window::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) | 359 void V8Window::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) |
360 { | 360 { |
361 LocalDOMWindow* impl = V8Window::toNative(info.Holder()); | 361 LocalDOMWindow* impl = V8Window::toNative(info.Holder()); |
362 ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "Win
dow", info.Holder(), info.GetIsolate()); | 362 ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "Win
dow", info.Holder(), info.GetIsolate()); |
363 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), exceptionState)) { | 363 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram
e(), exceptionState)) { |
364 exceptionState.throwIfNeeded(); | 364 exceptionState.throwIfNeeded(); |
365 return; | 365 return; |
366 } | 366 } |
367 | 367 |
368 TOSTRING_VOID(V8StringResource<WithUndefinedOrNullCheck>, urlString, info[0]
); | 368 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, urlString
, info[0]); |
369 AtomicString frameName; | 369 AtomicString frameName; |
370 if (info[1]->IsUndefined() || info[1]->IsNull()) { | 370 if (info[1]->IsUndefined() || info[1]->IsNull()) { |
371 frameName = "_blank"; | 371 frameName = "_blank"; |
372 } else { | 372 } else { |
373 TOSTRING_VOID(V8StringResource<>, frameNameResource, info[1]); | 373 TOSTRING_VOID(V8StringResource<>, frameNameResource, info[1]); |
374 frameName = frameNameResource; | 374 frameName = frameNameResource; |
375 } | 375 } |
376 TOSTRING_VOID(V8StringResource<WithUndefinedOrNullCheck>, windowFeaturesStri
ng, info[2]); | 376 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, windowFea
turesString, info[2]); |
377 | 377 |
378 RefPtrWillBeRawPtr<LocalDOMWindow> openedWindow = impl->open(urlString, fram
eName, windowFeaturesString, callingDOMWindow(info.GetIsolate()), enteredDOMWind
ow(info.GetIsolate())); | 378 RefPtrWillBeRawPtr<LocalDOMWindow> openedWindow = impl->open(urlString, fram
eName, windowFeaturesString, callingDOMWindow(info.GetIsolate()), enteredDOMWind
ow(info.GetIsolate())); |
379 if (!openedWindow) | 379 if (!openedWindow) |
380 return; | 380 return; |
381 | 381 |
382 v8SetReturnValueFast(info, openedWindow.release(), impl); | 382 v8SetReturnValueFast(info, openedWindow.release(), impl); |
383 } | 383 } |
384 | 384 |
385 void V8Window::namedPropertyGetterCustom(v8::Local<v8::String> name, const v8::P
ropertyCallbackInfo<v8::Value>& info) | 385 void V8Window::namedPropertyGetterCustom(v8::Local<v8::String> name, const v8::P
ropertyCallbackInfo<v8::Value>& info) |
386 { | 386 { |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::curren
t(isolate)); | 532 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::curren
t(isolate)); |
533 if (context.IsEmpty()) | 533 if (context.IsEmpty()) |
534 return v8Undefined(); | 534 return v8Undefined(); |
535 | 535 |
536 v8::Handle<v8::Object> global = context->Global(); | 536 v8::Handle<v8::Object> global = context->Global(); |
537 ASSERT(!global.IsEmpty()); | 537 ASSERT(!global.IsEmpty()); |
538 return global; | 538 return global; |
539 } | 539 } |
540 | 540 |
541 } // namespace WebCore | 541 } // namespace WebCore |
OLD | NEW |