| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 } | 286 } |
| 287 | 287 |
| 288 TextPosition ScriptController::eventHandlerPosition() const | 288 TextPosition ScriptController::eventHandlerPosition() const |
| 289 { | 289 { |
| 290 ScriptableDocumentParser* parser = m_frame->document()->scriptableDocumentPa
rser(); | 290 ScriptableDocumentParser* parser = m_frame->document()->scriptableDocumentPa
rser(); |
| 291 if (parser) | 291 if (parser) |
| 292 return parser->textPosition(); | 292 return parser->textPosition(); |
| 293 return TextPosition::minimumPosition(); | 293 return TextPosition::minimumPosition(); |
| 294 } | 294 } |
| 295 | 295 |
| 296 static inline v8::Local<v8::Context> contextForWorld(ScriptController* scriptCon
troller, DOMWrapperWorld* world) | 296 static inline v8::Local<v8::Context> contextForWorld(ScriptController& scriptCon
troller, DOMWrapperWorld* world) |
| 297 { | 297 { |
| 298 return scriptController->windowShell(world)->context(); | 298 return scriptController.windowShell(world)->context(); |
| 299 } | 299 } |
| 300 | 300 |
| 301 v8::Local<v8::Context> ScriptController::currentWorldContext() | 301 v8::Local<v8::Context> ScriptController::currentWorldContext() |
| 302 { | 302 { |
| 303 if (!v8::Context::InContext()) | 303 if (!v8::Context::InContext()) |
| 304 return contextForWorld(this, mainThreadNormalWorld()); | 304 return contextForWorld(*this, mainThreadNormalWorld()); |
| 305 | 305 |
| 306 v8::Handle<v8::Context> context = v8::Context::GetEntered(); | 306 v8::Handle<v8::Context> context = v8::Context::GetEntered(); |
| 307 DOMWrapperWorld* isolatedWorld = DOMWrapperWorld::isolatedWorld(context); | 307 DOMWrapperWorld* isolatedWorld = DOMWrapperWorld::isolatedWorld(context); |
| 308 if (!isolatedWorld) | 308 if (!isolatedWorld) |
| 309 return contextForWorld(this, mainThreadNormalWorld()); | 309 return contextForWorld(*this, mainThreadNormalWorld()); |
| 310 | 310 |
| 311 Frame* frame = toFrameIfNotDetached(context); | 311 Frame* frame = toFrameIfNotDetached(context); |
| 312 if (m_frame == frame) | 312 if (m_frame == frame) |
| 313 return v8::Local<v8::Context>::New(m_isolate, context); | 313 return v8::Local<v8::Context>::New(m_isolate, context); |
| 314 | 314 |
| 315 return contextForWorld(this, isolatedWorld); | 315 return contextForWorld(*this, isolatedWorld); |
| 316 } | 316 } |
| 317 | 317 |
| 318 v8::Local<v8::Context> ScriptController::mainWorldContext() | 318 v8::Local<v8::Context> ScriptController::mainWorldContext() |
| 319 { | 319 { |
| 320 return contextForWorld(this, mainThreadNormalWorld()); | 320 return contextForWorld(*this, mainThreadNormalWorld()); |
| 321 } | 321 } |
| 322 | 322 |
| 323 v8::Local<v8::Context> ScriptController::mainWorldContext(Frame* frame) | 323 v8::Local<v8::Context> ScriptController::mainWorldContext(Frame* frame) |
| 324 { | 324 { |
| 325 if (!frame) | 325 if (!frame) |
| 326 return v8::Local<v8::Context>(); | 326 return v8::Local<v8::Context>(); |
| 327 | 327 |
| 328 return contextForWorld(frame->script(), mainThreadNormalWorld()); | 328 return contextForWorld(frame->script(), mainThreadNormalWorld()); |
| 329 } | 329 } |
| 330 | 330 |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 v8Results = evaluateHandleScope.Close(resultArray); | 699 v8Results = evaluateHandleScope.Close(resultArray); |
| 700 } | 700 } |
| 701 | 701 |
| 702 if (results && !v8Results.IsEmpty()) { | 702 if (results && !v8Results.IsEmpty()) { |
| 703 for (size_t i = 0; i < v8Results->Length(); ++i) | 703 for (size_t i = 0; i < v8Results->Length(); ++i) |
| 704 results->append(ScriptValue(v8Results->Get(i), m_isolate)); | 704 results->append(ScriptValue(v8Results->Get(i), m_isolate)); |
| 705 } | 705 } |
| 706 } | 706 } |
| 707 | 707 |
| 708 } // namespace WebCore | 708 } // namespace WebCore |
| OLD | NEW |