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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 #include "weborigin/SecurityOrigin.h" | 58 #include "weborigin/SecurityOrigin.h" |
59 #include "wtf/Assertions.h" | 59 #include "wtf/Assertions.h" |
60 #include "wtf/OwnArrayPtr.h" | 60 #include "wtf/OwnArrayPtr.h" |
61 #include "wtf/StringExtras.h" | 61 #include "wtf/StringExtras.h" |
62 #include "wtf/text/CString.h" | 62 #include "wtf/text/CString.h" |
63 #include <algorithm> | 63 #include <algorithm> |
64 #include <utility> | 64 #include <utility> |
65 #include <v8-debug.h> | 65 #include <v8-debug.h> |
66 #include <v8.h> | 66 #include <v8.h> |
67 | 67 |
68 #if defined(USE_I18N_EXTENSION) | |
69 #include <v8-i18n/include/extension.h> | |
70 #endif | |
71 | |
72 namespace WebCore { | 68 namespace WebCore { |
73 | 69 |
74 static void checkDocumentWrapper(v8::Handle<v8::Object> wrapper, Document* docum
ent) | 70 static void checkDocumentWrapper(v8::Handle<v8::Object> wrapper, Document* docum
ent) |
75 { | 71 { |
76 ASSERT(V8Document::toNative(wrapper) == document); | 72 ASSERT(V8Document::toNative(wrapper) == document); |
77 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)); |
78 } | 74 } |
79 | 75 |
80 static void setInjectedScriptContextDebugId(v8::Handle<v8::Context> targetContex
t, int debugId) | 76 static void setInjectedScriptContextDebugId(v8::Handle<v8::Context> targetContex
t, int debugId) |
81 { | 77 { |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 // object. Reuse the global object if one has been created earlier. | 263 // object. Reuse the global object if one has been created earlier. |
268 v8::Handle<v8::ObjectTemplate> globalTemplate = V8Window::GetShadowObjectTem
plate(m_isolate, m_world->isMainWorld() ? MainWorld : IsolatedWorld); | 264 v8::Handle<v8::ObjectTemplate> globalTemplate = V8Window::GetShadowObjectTem
plate(m_isolate, m_world->isMainWorld() ? MainWorld : IsolatedWorld); |
269 if (globalTemplate.IsEmpty()) | 265 if (globalTemplate.IsEmpty()) |
270 return; | 266 return; |
271 | 267 |
272 double contextCreationStartInSeconds = currentTime(); | 268 double contextCreationStartInSeconds = currentTime(); |
273 | 269 |
274 // Used to avoid sleep calls in unload handlers. | 270 // Used to avoid sleep calls in unload handlers. |
275 ScriptController::registerExtensionIfNeeded(DateExtension::get()); | 271 ScriptController::registerExtensionIfNeeded(DateExtension::get()); |
276 | 272 |
277 #if defined(USE_I18N_EXTENSION) | |
278 // Enable i18n API in V8. | |
279 ScriptController::registerExtensionIfNeeded(v8_i18n::Extension::get()); | |
280 #endif | |
281 | |
282 // Dynamically tell v8 about our extensions now. | 273 // Dynamically tell v8 about our extensions now. |
283 const V8Extensions& extensions = ScriptController::registeredExtensions(); | 274 const V8Extensions& extensions = ScriptController::registeredExtensions(); |
284 OwnArrayPtr<const char*> extensionNames = adoptArrayPtr(new const char*[exte
nsions.size()]); | 275 OwnArrayPtr<const char*> extensionNames = adoptArrayPtr(new const char*[exte
nsions.size()]); |
285 int index = 0; | 276 int index = 0; |
286 int extensionGroup = m_world->extensionGroup(); | 277 int extensionGroup = m_world->extensionGroup(); |
287 int worldId = m_world->worldId(); | 278 int worldId = m_world->worldId(); |
288 for (size_t i = 0; i < extensions.size(); ++i) { | 279 for (size_t i = 0; i < extensions.size(); ++i) { |
289 // Ensure our date extension is always allowed. | 280 // Ensure our date extension is always allowed. |
290 if (extensions[i] != DateExtension::get() | 281 if (extensions[i] != DateExtension::get() |
291 && !m_frame->loader()->client()->allowScriptExtension(extensions[i]-
>name(), extensionGroup, worldId)) | 282 && !m_frame->loader()->client()->allowScriptExtension(extensions[i]-
>name(), extensionGroup, worldId)) |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 void V8WindowShell::updateSecurityOrigin() | 498 void V8WindowShell::updateSecurityOrigin() |
508 { | 499 { |
509 ASSERT(m_world->isMainWorld()); | 500 ASSERT(m_world->isMainWorld()); |
510 if (m_context.isEmpty()) | 501 if (m_context.isEmpty()) |
511 return; | 502 return; |
512 v8::HandleScope handleScope; | 503 v8::HandleScope handleScope; |
513 setSecurityToken(); | 504 setSecurityToken(); |
514 } | 505 } |
515 | 506 |
516 } // WebCore | 507 } // WebCore |
OLD | NEW |