Changeset 51621 in webkit
- Timestamp:
- Dec 2, 2009 9:20:24 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r51608 r51621 1 2009-12-02 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Web Inspector frontend heap allocates ScriptFunctionCall which is unsafe 6 https://bugs.webkit.org/show_bug.cgi?id=32098 7 8 Fix is simply to make the ScriptFunctionCall stack allocated as nature intended. 9 Doing this required adding an appendArgument(char*) to ScriptFunctionCall so 10 that an explicit String cast would not be necessary. 11 12 To prevent something like this happening again in future i've added private 13 operator new implementations to ScriptFunctionCall making this type of mistake 14 produce errors when compiling. 15 16 Test case: Inspector tests now pass with GC on every alloc enabled. 17 18 * bindings/js/ScriptFunctionCall.cpp: 19 (WebCore::ScriptFunctionCall::appendArgument): 20 * bindings/js/ScriptFunctionCall.h: 21 (WebCore::ScriptFunctionCall::operator new): 22 (WebCore::ScriptFunctionCall::operator new[]): 23 * inspector/InspectorFrontend.cpp: 24 (WebCore::InspectorFrontend::addConsoleMessage): 25 (WebCore::InspectorFrontend::updateConsoleMessageRepeatCount): 26 (WebCore::InspectorFrontend::addResource): 27 (WebCore::InspectorFrontend::updateResource): 28 (WebCore::InspectorFrontend::removeResource): 29 (WebCore::InspectorFrontend::updateFocusedNode): 30 (WebCore::InspectorFrontend::setAttachedWindow): 31 (WebCore::InspectorFrontend::addRecordToTimeline): 32 (WebCore::InspectorFrontend::parsedScriptSource): 33 (WebCore::InspectorFrontend::failedToParseScriptSource): 34 (WebCore::InspectorFrontend::addProfileHeader): 35 (WebCore::InspectorFrontend::setRecordingProfile): 36 (WebCore::InspectorFrontend::didGetProfileHeaders): 37 (WebCore::InspectorFrontend::didGetProfile): 38 (WebCore::InspectorFrontend::pausedScript): 39 (WebCore::InspectorFrontend::setDocument): 40 (WebCore::InspectorFrontend::setDetachedRoot): 41 (WebCore::InspectorFrontend::setChildNodes): 42 (WebCore::InspectorFrontend::childNodeCountUpdated): 43 (WebCore::InspectorFrontend::childNodeInserted): 44 (WebCore::InspectorFrontend::childNodeRemoved): 45 (WebCore::InspectorFrontend::attributesUpdated): 46 (WebCore::InspectorFrontend::didRemoveNode): 47 (WebCore::InspectorFrontend::didGetChildNodes): 48 (WebCore::InspectorFrontend::didApplyDomChange): 49 (WebCore::InspectorFrontend::didGetEventListenersForNode): 50 (WebCore::InspectorFrontend::didGetCookies): 51 (WebCore::InspectorFrontend::didDispatchOnInjectedScript): 52 (WebCore::InspectorFrontend::addDatabase): 53 (WebCore::InspectorFrontend::selectDatabase): 54 (WebCore::InspectorFrontend::didGetDatabaseTableNames): 55 (WebCore::InspectorFrontend::addDOMStorage): 56 (WebCore::InspectorFrontend::selectDOMStorage): 57 (WebCore::InspectorFrontend::didGetDOMStorageEntries): 58 (WebCore::InspectorFrontend::didSetDOMStorageItem): 59 (WebCore::InspectorFrontend::didRemoveDOMStorageItem): 60 (WebCore::InspectorFrontend::updateDOMStorage): 61 (WebCore::InspectorFrontend::addNodesToSearchResult): 62 (WebCore::InspectorFrontend::evaluateForTestInFrontend): 63 * inspector/InspectorFrontend.h: 64 1 65 2009-12-02 Dave Hyatt <hyatt@apple.com> 2 66 -
trunk/WebCore/bindings/js/ScriptFunctionCall.cpp
r51512 r51621 73 73 void ScriptFunctionCall::appendArgument(const JSC::UString& argument) 74 74 { 75 JSLock lock(SilenceAssertionsOnly); 76 m_arguments.append(jsString(m_exec, argument)); 77 } 78 79 void ScriptFunctionCall::appendArgument(const char* argument) 80 { 81 JSLock lock(SilenceAssertionsOnly); 75 82 m_arguments.append(jsString(m_exec, argument)); 76 83 } -
trunk/WebCore/bindings/js/ScriptFunctionCall.h
r51439 r51621 56 56 void appendArgument(const ScriptValue&); 57 57 void appendArgument(const String&); 58 void appendArgument(const char*); 58 59 void appendArgument(const JSC::UString&); 59 60 void appendArgument(JSC::JSValue); … … 73 74 String m_name; 74 75 JSC::MarkedArgumentBuffer m_arguments; 76 77 private: 78 // MarkedArgumentBuffer must be stack allocated, so prevent heap 79 // alloc of ScriptFunctionCall as well. 80 void* operator new(size_t) { ASSERT_NOT_REACHED(); return reinterpret_cast<void*>(0xbadbeef); } 81 void* operator new[](size_t) { ASSERT_NOT_REACHED(); return reinterpret_cast<void*>(0xbadbeef); } 75 82 }; 76 83 -
trunk/WebCore/inspector/InspectorFrontend.cpp
r51598 r51621 80 80 void InspectorFrontend::addConsoleMessage(const ScriptObject& messageObj, const Vector<ScriptString>& frames, const Vector<ScriptValue> wrappedArguments, const String& message) 81 81 { 82 OwnPtr<ScriptFunctionCall> function(newFunctionCall("addConsoleMessage")); 83 function->appendArgument(messageObj); 82 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 83 function.appendArgument("addConsoleMessage"); 84 function.appendArgument(messageObj); 84 85 if (!frames.isEmpty()) { 85 86 for (unsigned i = 0; i < frames.size(); ++i) 86 function ->appendArgument(frames[i]);87 function.appendArgument(frames[i]); 87 88 } else if (!wrappedArguments.isEmpty()) { 88 89 for (unsigned i = 0; i < wrappedArguments.size(); ++i) 89 function ->appendArgument(m_inspectorController->wrapObject(wrappedArguments[i], "console"));90 function.appendArgument(m_inspectorController->wrapObject(wrappedArguments[i], "console")); 90 91 } else 91 function ->appendArgument(message);92 function ->call();92 function.appendArgument(message); 93 function.call(); 93 94 } 94 95 95 96 void InspectorFrontend::updateConsoleMessageRepeatCount(const int count) 96 97 { 97 OwnPtr<ScriptFunctionCall> function(newFunctionCall("updateConsoleMessageRepeatCount")); 98 function->appendArgument(count); 99 function->call(); 98 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 99 function.appendArgument("updateConsoleMessageRepeatCount"); 100 function.appendArgument(count); 101 function.call(); 100 102 } 101 103 … … 107 109 bool InspectorFrontend::addResource(unsigned long identifier, const ScriptObject& resourceObj) 108 110 { 109 OwnPtr<ScriptFunctionCall> function(newFunctionCall("addResource")); 110 function->appendArgument(identifier); 111 function->appendArgument(resourceObj); 111 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 112 function.appendArgument("addResource"); 113 function.appendArgument(identifier); 114 function.appendArgument(resourceObj); 112 115 bool hadException = false; 113 function ->call(hadException);116 function.call(hadException); 114 117 return !hadException; 115 118 } … … 117 120 bool InspectorFrontend::updateResource(unsigned long identifier, const ScriptObject& resourceObj) 118 121 { 119 OwnPtr<ScriptFunctionCall> function(newFunctionCall("updateResource")); 120 function->appendArgument(identifier); 121 function->appendArgument(resourceObj); 122 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 123 function.appendArgument("updateResource"); 124 function.appendArgument(identifier); 125 function.appendArgument(resourceObj); 122 126 bool hadException = false; 123 function ->call(hadException);127 function.call(hadException); 124 128 return !hadException; 125 129 } … … 127 131 void InspectorFrontend::removeResource(unsigned long identifier) 128 132 { 129 OwnPtr<ScriptFunctionCall> function(newFunctionCall("removeResource")); 130 function->appendArgument(identifier); 131 function->call(); 133 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 134 function.appendArgument("removeResource"); 135 function.appendArgument(identifier); 136 function.call(); 132 137 } 133 138 134 139 void InspectorFrontend::updateFocusedNode(long nodeId) 135 140 { 136 OwnPtr<ScriptFunctionCall> function(newFunctionCall("updateFocusedNode")); 137 function->appendArgument(nodeId); 138 function->call(); 141 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 142 function.appendArgument("updateFocusedNode"); 143 function.appendArgument(nodeId); 144 function.call(); 139 145 } 140 146 141 147 void InspectorFrontend::setAttachedWindow(bool attached) 142 148 { 143 OwnPtr<ScriptFunctionCall> function(newFunctionCall("setAttachedWindow")); 144 function->appendArgument(attached); 145 function->call(); 149 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 150 function.appendArgument("setAttachedWindow"); 151 function.appendArgument(attached); 152 function.call(); 146 153 } 147 154 … … 212 219 void InspectorFrontend::addRecordToTimeline(const ScriptObject& record) 213 220 { 214 OwnPtr<ScriptFunctionCall> function(newFunctionCall("addRecordToTimeline")); 215 function->appendArgument(record); 216 function->call(); 221 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 222 function.appendArgument("addRecordToTimeline"); 223 function.appendArgument(record); 224 function.call(); 217 225 } 218 226 … … 245 253 void InspectorFrontend::parsedScriptSource(const JSC::SourceCode& source) 246 254 { 247 OwnPtr<ScriptFunctionCall> function(newFunctionCall("parsedScriptSource")); 248 function->appendArgument(JSC::UString(JSC::UString::from(source.provider()->asID()))); 249 function->appendArgument(source.provider()->url()); 250 function->appendArgument(JSC::UString(source.data(), source.length())); 251 function->appendArgument(source.firstLine()); 252 function->call(); 255 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 256 function.appendArgument("parsedScriptSource"); 257 function.appendArgument(JSC::UString(JSC::UString::from(source.provider()->asID()))); 258 function.appendArgument(source.provider()->url()); 259 function.appendArgument(JSC::UString(source.data(), source.length())); 260 function.appendArgument(source.firstLine()); 261 function.call(); 253 262 } 254 263 255 264 void InspectorFrontend::failedToParseScriptSource(const JSC::SourceCode& source, int errorLine, const JSC::UString& errorMessage) 256 265 { 257 OwnPtr<ScriptFunctionCall> function(newFunctionCall("failedToParseScriptSource")); 258 function->appendArgument(source.provider()->url()); 259 function->appendArgument(JSC::UString(source.data(), source.length())); 260 function->appendArgument(source.firstLine()); 261 function->appendArgument(errorLine); 262 function->appendArgument(errorMessage); 263 function->call(); 266 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 267 function.appendArgument("failedToParseScriptSource"); 268 function.appendArgument(source.provider()->url()); 269 function.appendArgument(JSC::UString(source.data(), source.length())); 270 function.appendArgument(source.firstLine()); 271 function.appendArgument(errorLine); 272 function.appendArgument(errorMessage); 273 function.call(); 264 274 } 265 275 266 276 void InspectorFrontend::addProfileHeader(const ScriptValue& profile) 267 277 { 268 OwnPtr<ScriptFunctionCall> function(newFunctionCall("addProfileHeader")); 269 function->appendArgument(profile); 270 function->call(); 278 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 279 function.appendArgument("addProfileHeader"); 280 function.appendArgument(profile); 281 function.call(); 271 282 } 272 283 273 284 void InspectorFrontend::setRecordingProfile(bool isProfiling) 274 285 { 275 OwnPtr<ScriptFunctionCall> function(newFunctionCall("setRecordingProfile")); 276 function->appendArgument(isProfiling); 277 function->call(); 286 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 287 function.appendArgument("setRecordingProfile"); 288 function.appendArgument(isProfiling); 289 function.call(); 278 290 } 279 291 280 292 void InspectorFrontend::didGetProfileHeaders(int callId, const ScriptArray& headers) 281 293 { 282 OwnPtr<ScriptFunctionCall> function(newFunctionCall("didGetProfileHeaders")); 283 function->appendArgument(callId); 284 function->appendArgument(headers); 285 function->call(); 294 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 295 function.appendArgument("didGetProfileHeaders"); 296 function.appendArgument(callId); 297 function.appendArgument(headers); 298 function.call(); 286 299 } 287 300 288 301 void InspectorFrontend::didGetProfile(int callId, const ScriptValue& profile) 289 302 { 290 OwnPtr<ScriptFunctionCall> function(newFunctionCall("didGetProfile")); 291 function->appendArgument(callId); 292 function->appendArgument(profile); 293 function->call(); 303 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 304 function.appendArgument("didGetProfile"); 305 function.appendArgument(callId); 306 function.appendArgument(profile); 307 function.call(); 294 308 } 295 309 296 310 void InspectorFrontend::pausedScript(const ScriptValue& callFrames) 297 311 { 298 OwnPtr<ScriptFunctionCall> function(newFunctionCall("pausedScript")); 299 function->appendArgument(callFrames); 300 function->call(); 312 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 313 function.appendArgument("pausedScript"); 314 function.appendArgument(callFrames); 315 function.call(); 301 316 } 302 317 … … 309 324 void InspectorFrontend::setDocument(const ScriptObject& root) 310 325 { 311 OwnPtr<ScriptFunctionCall> function(newFunctionCall("setDocument")); 312 function->appendArgument(root); 313 function->call(); 326 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 327 function.appendArgument("setDocument"); 328 function.appendArgument(root); 329 function.call(); 314 330 } 315 331 316 332 void InspectorFrontend::setDetachedRoot(const ScriptObject& root) 317 333 { 318 OwnPtr<ScriptFunctionCall> function(newFunctionCall("setDetachedRoot")); 319 function->appendArgument(root); 320 function->call(); 334 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 335 function.appendArgument("setDetachedRoot"); 336 function.appendArgument(root); 337 function.call(); 321 338 } 322 339 323 340 void InspectorFrontend::setChildNodes(int parentId, const ScriptArray& nodes) 324 341 { 325 OwnPtr<ScriptFunctionCall> function(newFunctionCall("setChildNodes")); 326 function->appendArgument(parentId); 327 function->appendArgument(nodes); 328 function->call(); 342 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 343 function.appendArgument("setChildNodes"); 344 function.appendArgument(parentId); 345 function.appendArgument(nodes); 346 function.call(); 329 347 } 330 348 331 349 void InspectorFrontend::childNodeCountUpdated(int id, int newValue) 332 350 { 333 OwnPtr<ScriptFunctionCall> function(newFunctionCall("childNodeCountUpdated")); 334 function->appendArgument(id); 335 function->appendArgument(newValue); 336 function->call(); 351 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 352 function.appendArgument("childNodeCountUpdated"); 353 function.appendArgument(id); 354 function.appendArgument(newValue); 355 function.call(); 337 356 } 338 357 339 358 void InspectorFrontend::childNodeInserted(int parentId, int prevId, const ScriptObject& node) 340 359 { 341 OwnPtr<ScriptFunctionCall> function(newFunctionCall("childNodeInserted")); 342 function->appendArgument(parentId); 343 function->appendArgument(prevId); 344 function->appendArgument(node); 345 function->call(); 360 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 361 function.appendArgument("childNodeInserted"); 362 function.appendArgument(parentId); 363 function.appendArgument(prevId); 364 function.appendArgument(node); 365 function.call(); 346 366 } 347 367 348 368 void InspectorFrontend::childNodeRemoved(int parentId, int id) 349 369 { 350 OwnPtr<ScriptFunctionCall> function(newFunctionCall("childNodeRemoved")); 351 function->appendArgument(parentId); 352 function->appendArgument(id); 353 function->call(); 370 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 371 function.appendArgument("childNodeRemoved"); 372 function.appendArgument(parentId); 373 function.appendArgument(id); 374 function.call(); 354 375 } 355 376 356 377 void InspectorFrontend::attributesUpdated(int id, const ScriptArray& attributes) 357 378 { 358 OwnPtr<ScriptFunctionCall> function(newFunctionCall("attributesUpdated")); 359 function->appendArgument(id); 360 function->appendArgument(attributes); 361 function->call(); 379 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 380 function.appendArgument("attributesUpdated"); 381 function.appendArgument(id); 382 function.appendArgument(attributes); 383 function.call(); 362 384 } 363 385 364 386 void InspectorFrontend::didRemoveNode(int callId, int nodeId) 365 387 { 366 OwnPtr<ScriptFunctionCall> function(newFunctionCall("didRemoveNode")); 367 function->appendArgument(callId); 368 function->appendArgument(nodeId); 369 function->call(); 388 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 389 function.appendArgument("didRemoveNode"); 390 function.appendArgument(callId); 391 function.appendArgument(nodeId); 392 function.call(); 370 393 } 371 394 372 395 void InspectorFrontend::didGetChildNodes(int callId) 373 396 { 374 OwnPtr<ScriptFunctionCall> function(newFunctionCall("didGetChildNodes")); 375 function->appendArgument(callId); 376 function->call(); 397 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 398 function.appendArgument("didGetChildNodes"); 399 function.appendArgument(callId); 400 function.call(); 377 401 } 378 402 379 403 void InspectorFrontend::didApplyDomChange(int callId, bool success) 380 404 { 381 OwnPtr<ScriptFunctionCall> function(newFunctionCall("didApplyDomChange")); 382 function->appendArgument(callId); 383 function->appendArgument(success); 384 function->call(); 405 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 406 function.appendArgument("didApplyDomChange"); 407 function.appendArgument(callId); 408 function.appendArgument(success); 409 function.call(); 385 410 } 386 411 387 412 void InspectorFrontend::didGetEventListenersForNode(int callId, int nodeId, ScriptArray& listenersArray) 388 413 { 389 OwnPtr<ScriptFunctionCall> function(newFunctionCall("didGetEventListenersForNode")); 390 function->appendArgument(callId); 391 function->appendArgument(nodeId); 392 function->appendArgument(listenersArray); 393 function->call(); 414 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 415 function.appendArgument("didGetEventListenersForNode"); 416 function.appendArgument(callId); 417 function.appendArgument(nodeId); 418 function.appendArgument(listenersArray); 419 function.call(); 394 420 } 395 421 396 422 void InspectorFrontend::didGetCookies(int callId, const ScriptArray& cookies, const String& cookiesString) 397 423 { 398 OwnPtr<ScriptFunctionCall> function(newFunctionCall("didGetCookies")); 399 function->appendArgument(callId); 400 function->appendArgument(cookies); 401 function->appendArgument(cookiesString); 402 function->call(); 424 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 425 function.appendArgument("didGetCookies"); 426 function.appendArgument(callId); 427 function.appendArgument(cookies); 428 function.appendArgument(cookiesString); 429 function.call(); 403 430 } 404 431 405 432 void InspectorFrontend::didDispatchOnInjectedScript(int callId, const String& result, bool isException) 406 433 { 407 OwnPtr<ScriptFunctionCall> function(newFunctionCall("didDispatchOnInjectedScript")); 408 function->appendArgument(callId); 409 function->appendArgument(result); 410 function->appendArgument(isException); 411 function->call(); 434 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 435 function.appendArgument("didDispatchOnInjectedScript"); 436 function.appendArgument(callId); 437 function.appendArgument(result); 438 function.appendArgument(isException); 439 function.call(); 412 440 } 413 441 … … 415 443 bool InspectorFrontend::addDatabase(const ScriptObject& dbObject) 416 444 { 417 OwnPtr<ScriptFunctionCall> function(newFunctionCall("addDatabase")); 418 function->appendArgument(dbObject); 445 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 446 function.appendArgument("addDatabase"); 447 function.appendArgument(dbObject); 419 448 bool hadException = false; 420 function ->call(hadException);449 function.call(hadException); 421 450 return !hadException; 422 451 } … … 424 453 void InspectorFrontend::selectDatabase(int databaseId) 425 454 { 426 OwnPtr<ScriptFunctionCall> function(newFunctionCall("selectDatabase")); 427 function->appendArgument(databaseId); 428 function->call(); 455 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 456 function.appendArgument("selectDatabase"); 457 function.appendArgument(databaseId); 458 function.call(); 429 459 } 430 460 void InspectorFrontend::didGetDatabaseTableNames(int callId, const ScriptArray& tableNames) 431 461 { 432 OwnPtr<ScriptFunctionCall> function(newFunctionCall("didGetDatabaseTableNames")); 433 function->appendArgument(callId); 434 function->appendArgument(tableNames); 435 function->call(); 462 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 463 function.appendArgument("didGetDatabaseTableNames"); 464 function.appendArgument(callId); 465 function.appendArgument(tableNames); 466 function.call(); 436 467 } 437 468 #endif … … 440 471 bool InspectorFrontend::addDOMStorage(const ScriptObject& domStorageObj) 441 472 { 442 OwnPtr<ScriptFunctionCall> function(newFunctionCall("addDOMStorage")); 443 function->appendArgument(domStorageObj); 473 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 474 function.appendArgument("addDOMStorage"); 475 function.appendArgument(domStorageObj); 444 476 bool hadException = false; 445 function ->call(hadException);477 function.call(hadException); 446 478 return !hadException; 447 479 } … … 449 481 void InspectorFrontend::selectDOMStorage(int storageId) 450 482 { 451 OwnPtr<ScriptFunctionCall> function(newFunctionCall("selectDOMStorage")); 452 function->appendArgument(storageId); 453 function->call(); 483 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 484 function.appendArgument("selectDOMStorage"); 485 function.appendArgument(storageId); 486 function.call(); 454 487 } 455 488 456 489 void InspectorFrontend::didGetDOMStorageEntries(int callId, const ScriptArray& entries) 457 490 { 458 OwnPtr<ScriptFunctionCall> function(newFunctionCall("didGetDOMStorageEntries")); 459 function->appendArgument(callId); 460 function->appendArgument(entries); 461 function->call(); 491 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 492 function.appendArgument("didGetDOMStorageEntries"); 493 function.appendArgument(callId); 494 function.appendArgument(entries); 495 function.call(); 462 496 } 463 497 464 498 void InspectorFrontend::didSetDOMStorageItem(int callId, bool success) 465 499 { 466 OwnPtr<ScriptFunctionCall> function(newFunctionCall("didSetDOMStorageItem")); 467 function->appendArgument(callId); 468 function->appendArgument(success); 469 function->call(); 500 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 501 function.appendArgument("didSetDOMStorageItem"); 502 function.appendArgument(callId); 503 function.appendArgument(success); 504 function.call(); 470 505 } 471 506 472 507 void InspectorFrontend::didRemoveDOMStorageItem(int callId, bool success) 473 508 { 474 OwnPtr<ScriptFunctionCall> function(newFunctionCall("didRemoveDOMStorageItem")); 475 function->appendArgument(callId); 476 function->appendArgument(success); 477 function->call(); 509 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 510 function.appendArgument("didRemoveDOMStorageItem"); 511 function.appendArgument(callId); 512 function.appendArgument(success); 513 function.call(); 478 514 } 479 515 480 516 void InspectorFrontend::updateDOMStorage(int storageId) 481 517 { 482 OwnPtr<ScriptFunctionCall> function(newFunctionCall("updateDOMStorage")); 483 function->appendArgument(storageId); 484 function->call(); 518 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 519 function.appendArgument("updateDOMStorage"); 520 function.appendArgument(storageId); 521 function.call(); 485 522 } 486 523 #endif … … 488 525 void InspectorFrontend::addNodesToSearchResult(const String& nodeIds) 489 526 { 490 OwnPtr<ScriptFunctionCall> function(newFunctionCall("addNodesToSearchResult")); 491 function->appendArgument(nodeIds); 492 function->call(); 527 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 528 function.appendArgument("addNodesToSearchResult"); 529 function.appendArgument(nodeIds); 530 function.call(); 493 531 } 494 532 495 533 void InspectorFrontend::evaluateForTestInFrontend(int callId, const String& script) 496 534 { 497 OwnPtr<ScriptFunctionCall> function(newFunctionCall("evaluateForTestInFrontend")); 498 function->appendArgument(callId); 499 function->appendArgument(script); 500 function->call(); 501 } 502 503 PassOwnPtr<ScriptFunctionCall> InspectorFrontend::newFunctionCall(const String& functionName) 504 { 505 ScriptFunctionCall* function = new ScriptFunctionCall(m_scriptState, m_webInspector, "dispatch"); 506 function->appendArgument(functionName); 507 return function; 535 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 536 function.appendArgument("evaluateForTestInFrontend"); 537 function.appendArgument(callId); 538 function.appendArgument(script); 539 function.call(); 508 540 } 509 541 -
trunk/WebCore/inspector/InspectorFrontend.h
r51439 r51621 137 137 void evaluateForTestInFrontend(int callId, const String& script); 138 138 private: 139 PassOwnPtr<ScriptFunctionCall> newFunctionCall(const String& functionName);140 139 void callSimpleFunction(const String& functionName); 141 140 InspectorController* m_inspectorController;
Note: See TracChangeset
for help on using the changeset viewer.