OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 return v8::Local<v8::Object>(v8::Object::Cast(*v8Value())); | 62 return v8::Local<v8::Object>(v8::Object::Cast(*v8Value())); |
63 } | 63 } |
64 | 64 |
65 bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, const S
criptObject& value) | 65 bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, const S
criptObject& value) |
66 { | 66 { |
67 ScriptScope scope(scriptState); | 67 ScriptScope scope(scriptState); |
68 scope.global()->Set(v8::String::NewSymbol(name), value.v8Value()); | 68 scope.global()->Set(v8::String::NewSymbol(name), value.v8Value()); |
69 return scope.success(); | 69 return scope.success(); |
70 } | 70 } |
71 | 71 |
72 #if ENABLE(INSPECTOR) | |
73 bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, Inspect
orFrontendHost* value) | 72 bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, Inspect
orFrontendHost* value) |
74 { | 73 { |
75 ScriptScope scope(scriptState); | 74 ScriptScope scope(scriptState); |
76 scope.global()->Set(v8::String::NewSymbol(name), toV8(value, v8::Handle<v8::
Object>(), scriptState->isolate())); | 75 scope.global()->Set(v8::String::NewSymbol(name), toV8(value, v8::Handle<v8::
Object>(), scriptState->isolate())); |
77 return scope.success(); | 76 return scope.success(); |
78 } | 77 } |
79 | 78 |
80 bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, Injecte
dScriptHost* value) | 79 bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, Injecte
dScriptHost* value) |
81 { | 80 { |
82 ScriptScope scope(scriptState); | 81 ScriptScope scope(scriptState); |
83 scope.global()->Set(v8::String::NewSymbol(name), toV8(value, v8::Handle<v8::
Object>(), scriptState->isolate())); | 82 scope.global()->Set(v8::String::NewSymbol(name), toV8(value, v8::Handle<v8::
Object>(), scriptState->isolate())); |
84 return scope.success(); | 83 return scope.success(); |
85 } | 84 } |
86 #endif | |
87 | 85 |
88 bool ScriptGlobalObject::get(ScriptState* scriptState, const char* name, ScriptO
bject& value) | 86 bool ScriptGlobalObject::get(ScriptState* scriptState, const char* name, ScriptO
bject& value) |
89 { | 87 { |
90 ScriptScope scope(scriptState); | 88 ScriptScope scope(scriptState); |
91 v8::Local<v8::Value> v8Value = scope.global()->Get(v8::String::NewSymbol(nam
e)); | 89 v8::Local<v8::Value> v8Value = scope.global()->Get(v8::String::NewSymbol(nam
e)); |
92 if (v8Value.IsEmpty()) | 90 if (v8Value.IsEmpty()) |
93 return false; | 91 return false; |
94 | 92 |
95 if (!v8Value->IsObject()) | 93 if (!v8Value->IsObject()) |
96 return false; | 94 return false; |
97 | 95 |
98 value = ScriptObject(scriptState, v8::Handle<v8::Object>(v8::Object::Cast(*v
8Value))); | 96 value = ScriptObject(scriptState, v8::Handle<v8::Object>(v8::Object::Cast(*v
8Value))); |
99 return true; | 97 return true; |
100 } | 98 } |
101 | 99 |
102 bool ScriptGlobalObject::remove(ScriptState* scriptState, const char* name) | 100 bool ScriptGlobalObject::remove(ScriptState* scriptState, const char* name) |
103 { | 101 { |
104 ScriptScope scope(scriptState); | 102 ScriptScope scope(scriptState); |
105 return scope.global()->Delete(v8::String::NewSymbol(name)); | 103 return scope.global()->Delete(v8::String::NewSymbol(name)); |
106 } | 104 } |
107 | 105 |
108 } // namespace WebCore | 106 } // namespace WebCore |
OLD | NEW |