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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 | 419 |
420 static void setUpDialog(DOMWindow* dialog, void* handler) | 420 static void setUpDialog(DOMWindow* dialog, void* handler) |
421 { | 421 { |
422 static_cast<DialogHandler*>(handler)->dialogCreated(dialog); | 422 static_cast<DialogHandler*>(handler)->dialogCreated(dialog); |
423 } | 423 } |
424 | 424 |
425 v8::Handle<v8::Value> V8DOMWindow::showModalDialogCallback(const v8::Arguments&
args) | 425 v8::Handle<v8::Value> V8DOMWindow::showModalDialogCallback(const v8::Arguments&
args) |
426 { | 426 { |
427 INC_STATS("DOM.DOMWindow.showModalDialog()"); | 427 INC_STATS("DOM.DOMWindow.showModalDialog()"); |
428 DOMWindow* impl = V8DOMWindow::toNative(args.Holder()); | 428 DOMWindow* impl = V8DOMWindow::toNative(args.Holder()); |
| 429 V8BindingState* state = V8BindingState::Only(); |
| 430 if (!V8BindingSecurity::canAccessFrame(state, impl->frame(), true)) |
| 431 return v8::Undefined(); |
429 | 432 |
430 V8BindingState* state = V8BindingState::Only(); | 433 // FIXME: Handle exceptions properly. |
| 434 String urlString = toWebCoreStringWithNullOrUndefinedCheck(args[0]); |
| 435 DialogHandler handler(args[1]); |
| 436 String dialogFeaturesString = toWebCoreStringWithNullOrUndefinedCheck(args[2
]); |
431 | 437 |
432 DOMWindow* activeWindow = state->activeWindow(); | 438 DOMWindow* activeWindow = state->activeWindow(); |
433 DOMWindow* firstWindow = state->firstWindow(); | 439 DOMWindow* firstWindow = state->firstWindow(); |
434 | |
435 // FIXME: Handle exceptions properly. | |
436 String urlString = toWebCoreStringWithNullOrUndefinedCheck(args[0]); | |
437 String dialogFeaturesString = toWebCoreStringWithNullOrUndefinedCheck(args[2
]); | |
438 | |
439 DialogHandler handler(args[1]); | |
440 | |
441 impl->showModalDialog(urlString, dialogFeaturesString, activeWindow, firstWi
ndow, setUpDialog, &handler); | 440 impl->showModalDialog(urlString, dialogFeaturesString, activeWindow, firstWi
ndow, setUpDialog, &handler); |
442 | 441 |
443 return handler.returnValue(); | 442 return handler.returnValue(); |
444 } | 443 } |
445 | 444 |
446 v8::Handle<v8::Value> V8DOMWindow::openCallback(const v8::Arguments& args) | 445 v8::Handle<v8::Value> V8DOMWindow::openCallback(const v8::Arguments& args) |
447 { | 446 { |
448 INC_STATS("DOM.DOMWindow.open()"); | 447 INC_STATS("DOM.DOMWindow.open()"); |
449 DOMWindow* impl = V8DOMWindow::toNative(args.Holder()); | 448 DOMWindow* impl = V8DOMWindow::toNative(args.Holder()); |
450 | |
451 V8BindingState* state = V8BindingState::Only(); | 449 V8BindingState* state = V8BindingState::Only(); |
452 | 450 if (!V8BindingSecurity::canAccessFrame(state, impl->frame(), true)) |
453 DOMWindow* activeWindow = state->activeWindow(); | 451 return v8::Undefined(); |
454 DOMWindow* firstWindow = state->firstWindow(); | |
455 | 452 |
456 // FIXME: Handle exceptions properly. | 453 // FIXME: Handle exceptions properly. |
457 String urlString = toWebCoreStringWithNullOrUndefinedCheck(args[0]); | 454 String urlString = toWebCoreStringWithNullOrUndefinedCheck(args[0]); |
458 AtomicString frameName = (args[1]->IsUndefined() || args[1]->IsNull()) ? "_b
lank" : AtomicString(toWebCoreString(args[1])); | 455 AtomicString frameName = (args[1]->IsUndefined() || args[1]->IsNull()) ? "_b
lank" : AtomicString(toWebCoreString(args[1])); |
459 String windowFeaturesString = toWebCoreStringWithNullOrUndefinedCheck(args[2
]); | 456 String windowFeaturesString = toWebCoreStringWithNullOrUndefinedCheck(args[2
]); |
460 | 457 |
| 458 DOMWindow* activeWindow = state->activeWindow(); |
| 459 DOMWindow* firstWindow = state->firstWindow(); |
461 RefPtr<DOMWindow> openedWindow = impl->open(urlString, frameName, windowFeat
uresString, activeWindow, firstWindow); | 460 RefPtr<DOMWindow> openedWindow = impl->open(urlString, frameName, windowFeat
uresString, activeWindow, firstWindow); |
462 if (!openedWindow) | 461 if (!openedWindow) |
463 return v8::Undefined(); | 462 return v8::Undefined(); |
| 463 |
464 return toV8(openedWindow.release()); | 464 return toV8(openedWindow.release()); |
465 } | 465 } |
466 | 466 |
467 v8::Handle<v8::Value> V8DOMWindow::indexedPropertyGetter(uint32_t index, const v
8::AccessorInfo& info) | 467 v8::Handle<v8::Value> V8DOMWindow::indexedPropertyGetter(uint32_t index, const v
8::AccessorInfo& info) |
468 { | 468 { |
469 INC_STATS("DOM.DOMWindow.IndexedPropertyGetter"); | 469 INC_STATS("DOM.DOMWindow.IndexedPropertyGetter"); |
470 | 470 |
471 DOMWindow* window = V8DOMWindow::toNative(info.Holder()); | 471 DOMWindow* window = V8DOMWindow::toNative(info.Holder()); |
472 if (!window) | 472 if (!window) |
473 return notHandledByInterceptor(); | 473 return notHandledByInterceptor(); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 v8::Handle<v8::Context> context = V8Proxy::context(frame); | 621 v8::Handle<v8::Context> context = V8Proxy::context(frame); |
622 if (context.IsEmpty()) | 622 if (context.IsEmpty()) |
623 return v8::Handle<v8::Object>(); | 623 return v8::Handle<v8::Object>(); |
624 | 624 |
625 v8::Handle<v8::Object> global = context->Global(); | 625 v8::Handle<v8::Object> global = context->Global(); |
626 ASSERT(!global.IsEmpty()); | 626 ASSERT(!global.IsEmpty()); |
627 return global; | 627 return global; |
628 } | 628 } |
629 | 629 |
630 } // namespace WebCore | 630 } // namespace WebCore |
OLD | NEW |