| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 #include "V8HTMLCollection.h" | 52 #include "V8HTMLCollection.h" |
| 53 #include "V8HTMLDocument.h" | 53 #include "V8HTMLDocument.h" |
| 54 #include "V8HiddenPropertyName.h" | 54 #include "V8HiddenPropertyName.h" |
| 55 #include "V8Initializer.h" | 55 #include "V8Initializer.h" |
| 56 #include "V8ObjectConstructor.h" | 56 #include "V8ObjectConstructor.h" |
| 57 #include "V8PerContextData.h" | 57 #include "V8PerContextData.h" |
| 58 #include <algorithm> | 58 #include <algorithm> |
| 59 #include <utility> | 59 #include <utility> |
| 60 #include <v8-debug.h> | 60 #include <v8-debug.h> |
| 61 #include <v8.h> | 61 #include <v8.h> |
| 62 #include <v8-i18n/include/extension.h> |
| 62 #include <wtf/Assertions.h> | 63 #include <wtf/Assertions.h> |
| 63 #include <wtf/OwnArrayPtr.h> | 64 #include <wtf/OwnArrayPtr.h> |
| 64 #include <wtf/StringExtras.h> | 65 #include <wtf/StringExtras.h> |
| 65 #include <wtf/text/CString.h> | 66 #include <wtf/text/CString.h> |
| 66 | 67 |
| 67 #if ENABLE(JAVASCRIPT_I18N_API) | |
| 68 #include <v8-i18n/include/extension.h> | |
| 69 #endif | |
| 70 | |
| 71 namespace WebCore { | 68 namespace WebCore { |
| 72 | 69 |
| 73 static void checkDocumentWrapper(v8::Handle<v8::Object> wrapper, Document* docum
ent) | 70 static void checkDocumentWrapper(v8::Handle<v8::Object> wrapper, Document* docum
ent) |
| 74 { | 71 { |
| 75 ASSERT(V8Document::toNative(wrapper) == document); | 72 ASSERT(V8Document::toNative(wrapper) == document); |
| 76 ASSERT(!document->isHTMLDocument() || (V8Document::toNative(v8::Handle<v8::O
bject>::Cast(wrapper->GetPrototype())) == document)); | 73 ASSERT(!document->isHTMLDocument() || (V8Document::toNative(v8::Handle<v8::O
bject>::Cast(wrapper->GetPrototype())) == document)); |
| 77 } | 74 } |
| 78 | 75 |
| 79 static void setInjectedScriptContextDebugId(v8::Handle<v8::Context> targetContex
t, int debugId) | 76 static void setInjectedScriptContextDebugId(v8::Handle<v8::Context> targetContex
t, int debugId) |
| 80 { | 77 { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 | 260 |
| 264 // Create a new environment using an empty template for the shadow | 261 // Create a new environment using an empty template for the shadow |
| 265 // object. Reuse the global object if one has been created earlier. | 262 // object. Reuse the global object if one has been created earlier. |
| 266 v8::Persistent<v8::ObjectTemplate> globalTemplate = V8DOMWindow::GetShadowOb
jectTemplate(m_isolate, m_world->isMainWorld() ? MainWorld : IsolatedWorld); | 263 v8::Persistent<v8::ObjectTemplate> globalTemplate = V8DOMWindow::GetShadowOb
jectTemplate(m_isolate, m_world->isMainWorld() ? MainWorld : IsolatedWorld); |
| 267 if (globalTemplate.IsEmpty()) | 264 if (globalTemplate.IsEmpty()) |
| 268 return; | 265 return; |
| 269 | 266 |
| 270 // Used to avoid sleep calls in unload handlers. | 267 // Used to avoid sleep calls in unload handlers. |
| 271 ScriptController::registerExtensionIfNeeded(DateExtension::get()); | 268 ScriptController::registerExtensionIfNeeded(DateExtension::get()); |
| 272 | 269 |
| 273 #if ENABLE(JAVASCRIPT_I18N_API) | |
| 274 // Enables experimental i18n API in V8. | 270 // Enables experimental i18n API in V8. |
| 275 if (RuntimeEnabledFeatures::javaScriptI18NAPIEnabled()) | 271 ScriptController::registerExtensionIfNeeded(v8_i18n::Extension::get()); |
| 276 ScriptController::registerExtensionIfNeeded(v8_i18n::Extension::get()); | |
| 277 #endif | |
| 278 | 272 |
| 279 // Dynamically tell v8 about our extensions now. | 273 // Dynamically tell v8 about our extensions now. |
| 280 const V8Extensions& extensions = ScriptController::registeredExtensions(); | 274 const V8Extensions& extensions = ScriptController::registeredExtensions(); |
| 281 OwnArrayPtr<const char*> extensionNames = adoptArrayPtr(new const char*[exte
nsions.size()]); | 275 OwnArrayPtr<const char*> extensionNames = adoptArrayPtr(new const char*[exte
nsions.size()]); |
| 282 int index = 0; | 276 int index = 0; |
| 283 int extensionGroup = m_world->extensionGroup(); | 277 int extensionGroup = m_world->extensionGroup(); |
| 284 int worldId = m_world->worldId(); | 278 int worldId = m_world->worldId(); |
| 285 for (size_t i = 0; i < extensions.size(); ++i) { | 279 for (size_t i = 0; i < extensions.size(); ++i) { |
| 286 // Ensure our date extension is always allowed. | 280 // Ensure our date extension is always allowed. |
| 287 if (extensions[i] != DateExtension::get() | 281 if (extensions[i] != DateExtension::get() |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 void V8DOMWindowShell::updateSecurityOrigin() | 483 void V8DOMWindowShell::updateSecurityOrigin() |
| 490 { | 484 { |
| 491 ASSERT(m_world->isMainWorld()); | 485 ASSERT(m_world->isMainWorld()); |
| 492 if (m_context.isEmpty()) | 486 if (m_context.isEmpty()) |
| 493 return; | 487 return; |
| 494 v8::HandleScope handleScope; | 488 v8::HandleScope handleScope; |
| 495 setSecurityToken(); | 489 setSecurityToken(); |
| 496 } | 490 } |
| 497 | 491 |
| 498 } // WebCore | 492 } // WebCore |
| OLD | NEW |