| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007-2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2007-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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 v8::Handle<v8::Value> args[] = { | 104 v8::Handle<v8::Value> args[] = { |
| 105 scriptHostWrapper, | 105 scriptHostWrapper, |
| 106 windowGlobal, | 106 windowGlobal, |
| 107 v8::Number::New(id) | 107 v8::Number::New(id) |
| 108 }; | 108 }; |
| 109 v8::Local<v8::Value> injectedScriptValue = v8::Function::Cast(*v)->Call(wind
owGlobal, 3, args); | 109 v8::Local<v8::Value> injectedScriptValue = v8::Function::Cast(*v)->Call(wind
owGlobal, 3, args); |
| 110 v8::Local<v8::Object> injectedScript(v8::Object::Cast(*injectedScriptValue))
; | 110 v8::Local<v8::Object> injectedScript(v8::Object::Cast(*injectedScriptValue))
; |
| 111 return ScriptObject(inspectedScriptState, injectedScript); | 111 return ScriptObject(inspectedScriptState, injectedScript); |
| 112 } | 112 } |
| 113 | 113 |
| 114 v8::Handle<v8::Value> V8InjectedScriptHost::inspectedWindowCallback(const v8::Ar
guments& args) | |
| 115 { | |
| 116 INC_STATS("InjectedScriptHost.inspectedWindow()"); | |
| 117 | |
| 118 InjectedScriptHost* host = V8DOMWrapper::convertToNativeObject<InjectedScrip
tHost>(V8ClassIndex::INJECTEDSCRIPTHOST, args.Holder()); | |
| 119 InspectorController* ic = host->inspectorController(); | |
| 120 if (!ic) | |
| 121 return v8::Undefined(); | |
| 122 return V8DOMWrapper::convertToV8Object<DOMWindow>(V8ClassIndex::DOMWINDOW, i
c->inspectedPage()->mainFrame()->domWindow()); | |
| 123 } | |
| 124 | |
| 125 v8::Handle<v8::Value> V8InjectedScriptHost::wrapCallbackCallback(const v8::Argum
ents& args) | |
| 126 { | |
| 127 INC_STATS("InjectedScriptHost.wrapCallback()"); | |
| 128 return args[0]; | |
| 129 } | |
| 130 | |
| 131 v8::Handle<v8::Value> V8InjectedScriptHost::nodeForIdCallback(const v8::Argument
s& args) | 114 v8::Handle<v8::Value> V8InjectedScriptHost::nodeForIdCallback(const v8::Argument
s& args) |
| 132 { | 115 { |
| 133 INC_STATS("InjectedScriptHost.nodeForId()"); | 116 INC_STATS("InjectedScriptHost.nodeForId()"); |
| 134 if (args.Length() < 1) | 117 if (args.Length() < 1) |
| 135 return v8::Undefined(); | 118 return v8::Undefined(); |
| 136 | 119 |
| 137 InjectedScriptHost* host = V8DOMWrapper::convertToNativeObject<InjectedScrip
tHost>(V8ClassIndex::INJECTEDSCRIPTHOST, args.Holder()); | 120 InjectedScriptHost* host = V8DOMWrapper::convertToNativeObject<InjectedScrip
tHost>(V8ClassIndex::INJECTEDSCRIPTHOST, args.Holder()); |
| 138 | 121 |
| 139 Node* node = host->nodeForId(args[0]->ToInt32()->Value()); | 122 Node* node = host->nodeForId(args[0]->ToInt32()->Value()); |
| 140 if (!node) | 123 if (!node) |
| 141 return v8::Undefined(); | 124 return v8::Undefined(); |
| 142 | 125 |
| 143 InspectorController* ic = host->inspectorController(); | 126 InspectorController* ic = host->inspectorController(); |
| 144 if (!ic) | 127 if (!ic) |
| 145 return v8::Undefined(); | 128 return v8::Undefined(); |
| 146 | 129 |
| 147 return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODE, node); | 130 return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODE, node); |
| 148 } | 131 } |
| 149 | 132 |
| 150 v8::Handle<v8::Value> V8InjectedScriptHost::wrapObjectCallback(const v8::Argumen
ts& args) | |
| 151 { | |
| 152 INC_STATS("InjectedScriptHost.wrapObject()"); | |
| 153 if (args.Length() < 2) | |
| 154 return v8::Undefined(); | |
| 155 | |
| 156 InjectedScriptHost* host = V8DOMWrapper::convertToNativeObject<InjectedScrip
tHost>(V8ClassIndex::INJECTEDSCRIPTHOST, args.Holder()); | |
| 157 return host->wrapObject(ScriptValue(args[0]), toWebCoreStringWithNullCheck(a
rgs[1])).v8Value(); | |
| 158 } | |
| 159 | |
| 160 v8::Handle<v8::Value> V8InjectedScriptHost::unwrapObjectCallback(const v8::Argum
ents& args) | |
| 161 { | |
| 162 INC_STATS("InjectedScriptHost.unwrapObject()"); | |
| 163 if (args.Length() < 1) | |
| 164 return v8::Undefined(); | |
| 165 | |
| 166 InjectedScriptHost* host = V8DOMWrapper::convertToNativeObject<InjectedScrip
tHost>(V8ClassIndex::INJECTEDSCRIPTHOST, args.Holder()); | |
| 167 return host->unwrapObject(toWebCoreStringWithNullCheck(args[0])).v8Value(); | |
| 168 } | |
| 169 | |
| 170 v8::Handle<v8::Value> V8InjectedScriptHost::pushNodePathToFrontendCallback(const
v8::Arguments& args) | 133 v8::Handle<v8::Value> V8InjectedScriptHost::pushNodePathToFrontendCallback(const
v8::Arguments& args) |
| 171 { | 134 { |
| 172 INC_STATS("InjectedScriptHost.pushNodePathToFrontend()"); | 135 INC_STATS("InjectedScriptHost.pushNodePathToFrontend()"); |
| 173 if (args.Length() < 3) | 136 if (args.Length() < 3) |
| 174 return v8::Undefined(); | 137 return v8::Undefined(); |
| 175 | 138 |
| 176 InjectedScriptHost* host = V8DOMWrapper::convertToNativeObject<InjectedScrip
tHost>(V8ClassIndex::INJECTEDSCRIPTHOST, args.Holder()); | 139 InjectedScriptHost* host = V8DOMWrapper::convertToNativeObject<InjectedScrip
tHost>(V8ClassIndex::INJECTEDSCRIPTHOST, args.Holder()); |
| 177 Node* node = V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Obje
ct>::Cast(args[0])); | 140 Node* node = V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Obje
ct>::Cast(args[0])); |
| 178 bool withChildren = args[1]->ToBoolean()->Value(); | 141 bool withChildren = args[1]->ToBoolean()->Value(); |
| 179 bool selectInUI = args[2]->ToBoolean()->Value(); | 142 bool selectInUI = args[2]->ToBoolean()->Value(); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 209 |
| 247 ASSERT(!m_injectedScriptSource.isEmpty()); | 210 ASSERT(!m_injectedScriptSource.isEmpty()); |
| 248 ScriptObject injectedScriptObject = createInjectedScript(m_injectedScriptSou
rce, this, inspectedScriptState, m_nextInjectedScriptId); | 211 ScriptObject injectedScriptObject = createInjectedScript(m_injectedScriptSou
rce, this, inspectedScriptState, m_nextInjectedScriptId); |
| 249 m_idToInjectedScript.set(m_nextInjectedScriptId, injectedScriptObject); | 212 m_idToInjectedScript.set(m_nextInjectedScriptId, injectedScriptObject); |
| 250 ++m_nextInjectedScriptId; | 213 ++m_nextInjectedScriptId; |
| 251 global->SetHiddenValue(key, injectedScriptObject.v8Object()); | 214 global->SetHiddenValue(key, injectedScriptObject.v8Object()); |
| 252 return injectedScriptObject; | 215 return injectedScriptObject; |
| 253 } | 216 } |
| 254 | 217 |
| 255 } // namespace WebCore | 218 } // namespace WebCore |
| OLD | NEW |