Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 ScriptFunctionCall function(injectedScriptObject(), "nodeForObjectId"); | 250 ScriptFunctionCall function(injectedScriptObject(), "nodeForObjectId"); |
| 251 function.appendArgument(objectId); | 251 function.appendArgument(objectId); |
| 252 | 252 |
| 253 bool hadException = false; | 253 bool hadException = false; |
| 254 ScriptValue resultValue = callFunctionWithEvalEnabled(function, hadException ); | 254 ScriptValue resultValue = callFunctionWithEvalEnabled(function, hadException ); |
| 255 ASSERT(!hadException); | 255 ASSERT(!hadException); |
| 256 | 256 |
| 257 return InjectedScriptHost::scriptValueAsNode(scriptState(), resultValue); | 257 return InjectedScriptHost::scriptValueAsNode(scriptState(), resultValue); |
| 258 } | 258 } |
| 259 | 259 |
| 260 EventTarget* InjectedScript::eventTargetForObjectId(const String& objectId) | |
| 261 { | |
| 262 if (isEmpty() || !canAccessInspectedWindow()) | |
| 263 return nullptr; | |
| 264 | |
| 265 ScriptFunctionCall function(injectedScriptObject(), "findObjectById"); | |
|
pfeldman
2015/04/10 08:45:11
Just use InjectedScript::findObjectById, there is
kozy
2015/04/13 14:26:53
Done.
| |
| 266 function.appendArgument(objectId); | |
| 267 | |
| 268 bool hadException = false; | |
| 269 ScriptValue resultValue = callFunctionWithEvalEnabled(function, hadException ); | |
| 270 ASSERT(!hadException); | |
| 271 | |
| 272 return InjectedScriptHost::scriptValueAsEventTarget(scriptState(), resultVal ue); | |
| 273 } | |
| 274 | |
| 260 void InjectedScript::releaseObject(const String& objectId) | 275 void InjectedScript::releaseObject(const String& objectId) |
| 261 { | 276 { |
| 262 RefPtr<JSONValue> parsedObjectId = parseJSON(objectId); | 277 RefPtr<JSONValue> parsedObjectId = parseJSON(objectId); |
| 263 if (!parsedObjectId) | 278 if (!parsedObjectId) |
| 264 return; | 279 return; |
| 265 RefPtr<JSONObject> object; | 280 RefPtr<JSONObject> object; |
| 266 if (!parsedObjectId->asObject(&object)) | 281 if (!parsedObjectId->asObject(&object)) |
| 267 return; | 282 return; |
| 268 int boundId = 0; | 283 int boundId = 0; |
| 269 if (!object->getNumber("id", &boundId)) | 284 if (!object->getNumber("id", &boundId)) |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 358 { | 373 { |
| 359 ASSERT(!isEmpty()); | 374 ASSERT(!isEmpty()); |
| 360 ScriptFunctionCall function(injectedScriptObject(), "setCustomObjectFormatte rEnabled"); | 375 ScriptFunctionCall function(injectedScriptObject(), "setCustomObjectFormatte rEnabled"); |
| 361 function.appendArgument(enabled); | 376 function.appendArgument(enabled); |
| 362 RefPtr<JSONValue> result; | 377 RefPtr<JSONValue> result; |
| 363 makeCall(function, &result); | 378 makeCall(function, &result); |
| 364 } | 379 } |
| 365 | 380 |
| 366 } // namespace blink | 381 } // namespace blink |
| 367 | 382 |
| OLD | NEW |