| 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 private: | 302 private: |
| 303 RefPtr<ScriptState> m_scriptState; | 303 RefPtr<ScriptState> m_scriptState; |
| 304 RefPtr<ScriptState> m_scriptStateForDialogFrame; | 304 RefPtr<ScriptState> m_scriptStateForDialogFrame; |
| 305 v8::Handle<v8::Value> m_dialogArguments; | 305 v8::Handle<v8::Value> m_dialogArguments; |
| 306 }; | 306 }; |
| 307 | 307 |
| 308 void DialogHandler::dialogCreated(DOMWindow* dialogFrame) | 308 void DialogHandler::dialogCreated(DOMWindow* dialogFrame) |
| 309 { | 309 { |
| 310 if (m_dialogArguments.IsEmpty()) | 310 if (m_dialogArguments.IsEmpty()) |
| 311 return; | 311 return; |
| 312 v8::Isolate* isolate = m_scriptState->isolate(); | 312 v8::Handle<v8::Context> context = toV8Context(dialogFrame->frame(), m_script
State->world()); |
| 313 v8::Handle<v8::Context> context = toV8Context(isolate, dialogFrame->frame(),
m_scriptState->world()); | |
| 314 if (context.IsEmpty()) | 313 if (context.IsEmpty()) |
| 315 return; | 314 return; |
| 316 m_scriptStateForDialogFrame = ScriptState::from(context); | 315 m_scriptStateForDialogFrame = ScriptState::from(context); |
| 317 | 316 |
| 318 ScriptState::Scope scope(m_scriptStateForDialogFrame.get()); | 317 ScriptState::Scope scope(m_scriptStateForDialogFrame.get()); |
| 319 m_scriptStateForDialogFrame->context()->Global()->Set(v8AtomicString(isolate
, "dialogArguments"), m_dialogArguments); | 318 m_scriptStateForDialogFrame->context()->Global()->Set(v8AtomicString(m_scrip
tState->isolate(), "dialogArguments"), m_dialogArguments); |
| 320 } | 319 } |
| 321 | 320 |
| 322 v8::Handle<v8::Value> DialogHandler::returnValue() const | 321 v8::Handle<v8::Value> DialogHandler::returnValue() const |
| 323 { | 322 { |
| 324 if (!m_scriptStateForDialogFrame) | 323 if (!m_scriptStateForDialogFrame) |
| 325 return v8Undefined(); | 324 return v8Undefined(); |
| 326 ASSERT(!m_scriptStateForDialogFrame->contextIsEmpty()); | 325 ASSERT(!m_scriptStateForDialogFrame->contextIsEmpty()); |
| 327 | 326 |
| 328 v8::Isolate* isolate = m_scriptStateForDialogFrame->isolate(); | 327 v8::Isolate* isolate = m_scriptStateForDialogFrame->isolate(); |
| 329 v8::EscapableHandleScope handleScope(isolate); | 328 v8::EscapableHandleScope handleScope(isolate); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 // Notice that we explicitly ignore creationContext because the DOMWindow is
its own creationContext. | 522 // Notice that we explicitly ignore creationContext because the DOMWindow is
its own creationContext. |
| 524 | 523 |
| 525 if (!window) | 524 if (!window) |
| 526 return v8::Null(isolate); | 525 return v8::Null(isolate); |
| 527 // Initializes environment of a frame, and return the global object | 526 // Initializes environment of a frame, and return the global object |
| 528 // of the frame. | 527 // of the frame. |
| 529 LocalFrame* frame = window->frame(); | 528 LocalFrame* frame = window->frame(); |
| 530 if (!frame) | 529 if (!frame) |
| 531 return v8Undefined(); | 530 return v8Undefined(); |
| 532 | 531 |
| 533 v8::Handle<v8::Context> context = toV8Context(isolate, frame, DOMWrapperWorl
d::current(isolate)); | 532 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::curren
t(isolate)); |
| 534 if (context.IsEmpty()) | 533 if (context.IsEmpty()) |
| 535 return v8Undefined(); | 534 return v8Undefined(); |
| 536 | 535 |
| 537 v8::Handle<v8::Object> global = context->Global(); | 536 v8::Handle<v8::Object> global = context->Global(); |
| 538 ASSERT(!global.IsEmpty()); | 537 ASSERT(!global.IsEmpty()); |
| 539 return global; | 538 return global; |
| 540 } | 539 } |
| 541 | 540 |
| 542 } // namespace WebCore | 541 } // namespace WebCore |
| OLD | NEW |