| 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 return InjectedScriptHost::scriptValueAsEventTarget(scriptState(), findObjec
tById(objectId)); |
| 265 } |
| 266 |
| 260 void InjectedScript::releaseObject(const String& objectId) | 267 void InjectedScript::releaseObject(const String& objectId) |
| 261 { | 268 { |
| 262 RefPtr<JSONValue> parsedObjectId = parseJSON(objectId); | 269 RefPtr<JSONValue> parsedObjectId = parseJSON(objectId); |
| 263 if (!parsedObjectId) | 270 if (!parsedObjectId) |
| 264 return; | 271 return; |
| 265 RefPtr<JSONObject> object; | 272 RefPtr<JSONObject> object; |
| 266 if (!parsedObjectId->asObject(&object)) | 273 if (!parsedObjectId->asObject(&object)) |
| 267 return; | 274 return; |
| 268 int boundId = 0; | 275 int boundId = 0; |
| 269 if (!object->getNumber("id", &boundId)) | 276 if (!object->getNumber("id", &boundId)) |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 { | 365 { |
| 359 ASSERT(!isEmpty()); | 366 ASSERT(!isEmpty()); |
| 360 ScriptFunctionCall function(injectedScriptObject(), "setCustomObjectFormatte
rEnabled"); | 367 ScriptFunctionCall function(injectedScriptObject(), "setCustomObjectFormatte
rEnabled"); |
| 361 function.appendArgument(enabled); | 368 function.appendArgument(enabled); |
| 362 RefPtr<JSONValue> result; | 369 RefPtr<JSONValue> result; |
| 363 makeCall(function, &result); | 370 makeCall(function, &result); |
| 364 } | 371 } |
| 365 | 372 |
| 366 } // namespace blink | 373 } // namespace blink |
| 367 | 374 |
| OLD | NEW |