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 * Copyright (C) 2014 Opera Software ASA. All rights reserved. | 4 * Copyright (C) 2014 Opera Software ASA. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions are | 7 * modification, are permitted provided that the following conditions are |
8 * met: | 8 * met: |
9 * | 9 * |
10 * * Redistributions of source code must retain the above copyright | 10 * * Redistributions of source code must retain the above copyright |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 } | 267 } |
268 | 268 |
269 // Create a V8 object with an interceptor of NPObjectPropertyGetter. | 269 // Create a V8 object with an interceptor of NPObjectPropertyGetter. |
270 void ScriptController::bindToWindowObject(LocalFrame* frame, const String& key,
NPObject* object) | 270 void ScriptController::bindToWindowObject(LocalFrame* frame, const String& key,
NPObject* object) |
271 { | 271 { |
272 ScriptState* scriptState = ScriptState::forMainWorld(frame); | 272 ScriptState* scriptState = ScriptState::forMainWorld(frame); |
273 if (!scriptState->contextIsValid()) | 273 if (!scriptState->contextIsValid()) |
274 return; | 274 return; |
275 | 275 |
276 ScriptState::Scope scope(scriptState); | 276 ScriptState::Scope scope(scriptState); |
277 v8::Handle<v8::Object> value = createV8ObjectForNPObject(object, 0, m_isolat
e); | 277 v8::Handle<v8::Object> value = createV8ObjectForNPObject(m_isolate, object,
0); |
278 | 278 |
279 // Attach to the global object. | 279 // Attach to the global object. |
280 scriptState->context()->Global()->Set(v8String(m_isolate, key), value); | 280 scriptState->context()->Global()->Set(v8String(m_isolate, key), value); |
281 } | 281 } |
282 | 282 |
283 void ScriptController::enableEval() | 283 void ScriptController::enableEval() |
284 { | 284 { |
285 if (!m_windowProxy->isContextInitialized()) | 285 if (!m_windowProxy->isContextInitialized()) |
286 return; | 286 return; |
287 v8::HandleScope handleScope(m_isolate); | 287 v8::HandleScope handleScope(m_isolate); |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 resultArray->Set(i, evaluationResult); | 644 resultArray->Set(i, evaluationResult); |
645 } | 645 } |
646 | 646 |
647 if (results) { | 647 if (results) { |
648 for (size_t i = 0; i < resultArray->Length(); ++i) | 648 for (size_t i = 0; i < resultArray->Length(); ++i) |
649 results->append(handleScope.Escape(resultArray->Get(i))); | 649 results->append(handleScope.Escape(resultArray->Get(i))); |
650 } | 650 } |
651 } | 651 } |
652 | 652 |
653 } // namespace blink | 653 } // namespace blink |
OLD | NEW |