Changeset 51621 in webkit


Ignore:
Timestamp:
Dec 2, 2009 9:20:24 PM (14 years ago)
Author:
oliver@apple.com
Message:

Web Inspector frontend heap allocates ScriptFunctionCall which is unsafe
https://bugs.webkit.org/show_bug.cgi?id=32098

Reviewed by Sam Weinig.

Fix is simply to make the ScriptFunctionCall stack allocated as nature intended
Doing this required adding an appendArgument(char*) to ScriptFunctionCall so
that an explicit String cast would not be necessary.

To prevent something like this happening again in future i've added private
operator new implementations to ScriptFunctionCall making this type of mistake
produce errors when compiling.

Test case: Inspector tests now pass with GC on every alloc enabled.

Location:
trunk/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r51608 r51621  
     12009-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
    1652009-12-02  Dave Hyatt  <hyatt@apple.com>
    266
  • trunk/WebCore/bindings/js/ScriptFunctionCall.cpp

    r51512 r51621  
    7373void ScriptFunctionCall::appendArgument(const JSC::UString& argument)
    7474{
     75    JSLock lock(SilenceAssertionsOnly);
     76    m_arguments.append(jsString(m_exec, argument));
     77}
     78
     79void ScriptFunctionCall::appendArgument(const char* argument)
     80{
     81    JSLock lock(SilenceAssertionsOnly);
    7582    m_arguments.append(jsString(m_exec, argument));
    7683}
  • trunk/WebCore/bindings/js/ScriptFunctionCall.h

    r51439 r51621  
    5656        void appendArgument(const ScriptValue&);
    5757        void appendArgument(const String&);
     58        void appendArgument(const char*);
    5859        void appendArgument(const JSC::UString&);
    5960        void appendArgument(JSC::JSValue);
     
    7374        String m_name;
    7475        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); }
    7582    };
    7683
  • trunk/WebCore/inspector/InspectorFrontend.cpp

    r51598 r51621  
    8080void InspectorFrontend::addConsoleMessage(const ScriptObject& messageObj, const Vector<ScriptString>& frames, const Vector<ScriptValue> wrappedArguments, const String& message)
    8181{
    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);
    8485    if (!frames.isEmpty()) {
    8586        for (unsigned i = 0; i < frames.size(); ++i)
    86             function->appendArgument(frames[i]);
     87            function.appendArgument(frames[i]);
    8788    } else if (!wrappedArguments.isEmpty()) {
    8889        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"));
    9091    } else
    91         function->appendArgument(message);
    92     function->call();
     92        function.appendArgument(message);
     93    function.call();
    9394}
    9495
    9596void InspectorFrontend::updateConsoleMessageRepeatCount(const int count)
    9697{
    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();
    100102}
    101103
     
    107109bool InspectorFrontend::addResource(unsigned long identifier, const ScriptObject& resourceObj)
    108110{
    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);
    112115    bool hadException = false;
    113     function->call(hadException);
     116    function.call(hadException);
    114117    return !hadException;
    115118}
     
    117120bool InspectorFrontend::updateResource(unsigned long identifier, const ScriptObject& resourceObj)
    118121{
    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);
    122126    bool hadException = false;
    123     function->call(hadException);
     127    function.call(hadException);
    124128    return !hadException;
    125129}
     
    127131void InspectorFrontend::removeResource(unsigned long identifier)
    128132{
    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();
    132137}
    133138
    134139void InspectorFrontend::updateFocusedNode(long nodeId)
    135140{
    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();
    139145}
    140146
    141147void InspectorFrontend::setAttachedWindow(bool attached)
    142148{
    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();
    146153}
    147154
     
    212219void InspectorFrontend::addRecordToTimeline(const ScriptObject& record)
    213220{
    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();
    217225}
    218226
     
    245253void InspectorFrontend::parsedScriptSource(const JSC::SourceCode& source)
    246254{
    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();
    253262}
    254263
    255264void InspectorFrontend::failedToParseScriptSource(const JSC::SourceCode& source, int errorLine, const JSC::UString& errorMessage)
    256265{
    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();
    264274}
    265275
    266276void InspectorFrontend::addProfileHeader(const ScriptValue& profile)
    267277{
    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();
    271282}
    272283
    273284void InspectorFrontend::setRecordingProfile(bool isProfiling)
    274285{
    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();
    278290}
    279291
    280292void InspectorFrontend::didGetProfileHeaders(int callId, const ScriptArray& headers)
    281293{
    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();
    286299}
    287300
    288301void InspectorFrontend::didGetProfile(int callId, const ScriptValue& profile)
    289302{
    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();
    294308}
    295309
    296310void InspectorFrontend::pausedScript(const ScriptValue& callFrames)
    297311{
    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();
    301316}
    302317
     
    309324void InspectorFrontend::setDocument(const ScriptObject& root)
    310325{
    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();
    314330}
    315331
    316332void InspectorFrontend::setDetachedRoot(const ScriptObject& root)
    317333{
    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();
    321338}
    322339
    323340void InspectorFrontend::setChildNodes(int parentId, const ScriptArray& nodes)
    324341{
    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();
    329347}
    330348
    331349void InspectorFrontend::childNodeCountUpdated(int id, int newValue)
    332350{
    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();
    337356}
    338357
    339358void InspectorFrontend::childNodeInserted(int parentId, int prevId, const ScriptObject& node)
    340359{
    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();
    346366}
    347367
    348368void InspectorFrontend::childNodeRemoved(int parentId, int id)
    349369{
    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();
    354375}
    355376
    356377void InspectorFrontend::attributesUpdated(int id, const ScriptArray& attributes)
    357378{
    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();
    362384}
    363385
    364386void InspectorFrontend::didRemoveNode(int callId, int nodeId)
    365387{
    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();
    370393}
    371394
    372395void InspectorFrontend::didGetChildNodes(int callId)
    373396{
    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();
    377401}
    378402
    379403void InspectorFrontend::didApplyDomChange(int callId, bool success)
    380404{
    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();
    385410}
    386411
    387412void InspectorFrontend::didGetEventListenersForNode(int callId, int nodeId, ScriptArray& listenersArray)
    388413{
    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();
    394420}
    395421
    396422void InspectorFrontend::didGetCookies(int callId, const ScriptArray& cookies, const String& cookiesString)
    397423{
    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();
    403430}
    404431
    405432void InspectorFrontend::didDispatchOnInjectedScript(int callId, const String& result, bool isException)
    406433{
    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();
    412440}
    413441
     
    415443bool InspectorFrontend::addDatabase(const ScriptObject& dbObject)
    416444{
    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);
    419448    bool hadException = false;
    420     function->call(hadException);
     449    function.call(hadException);
    421450    return !hadException;
    422451}
     
    424453void InspectorFrontend::selectDatabase(int databaseId)
    425454{
    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();
    429459}
    430460void InspectorFrontend::didGetDatabaseTableNames(int callId, const ScriptArray& tableNames)
    431461{
    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();
    436467}
    437468#endif
     
    440471bool InspectorFrontend::addDOMStorage(const ScriptObject& domStorageObj)
    441472{
    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);
    444476    bool hadException = false;
    445     function->call(hadException);
     477    function.call(hadException);
    446478    return !hadException;
    447479}
     
    449481void InspectorFrontend::selectDOMStorage(int storageId)
    450482{
    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();
    454487}
    455488
    456489void InspectorFrontend::didGetDOMStorageEntries(int callId, const ScriptArray& entries)
    457490{
    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();
    462496}
    463497
    464498void InspectorFrontend::didSetDOMStorageItem(int callId, bool success)
    465499{
    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();
    470505}
    471506
    472507void InspectorFrontend::didRemoveDOMStorageItem(int callId, bool success)
    473508{
    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();
    478514}
    479515
    480516void InspectorFrontend::updateDOMStorage(int storageId)
    481517{
    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();
    485522}
    486523#endif
     
    488525void InspectorFrontend::addNodesToSearchResult(const String& nodeIds)
    489526{
    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();
    493531}
    494532
    495533void InspectorFrontend::evaluateForTestInFrontend(int callId, const String& script)
    496534{
    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();
    508540}
    509541
  • trunk/WebCore/inspector/InspectorFrontend.h

    r51439 r51621  
    137137        void evaluateForTestInFrontend(int callId, const String& script);
    138138    private:
    139         PassOwnPtr<ScriptFunctionCall> newFunctionCall(const String& functionName);
    140139        void callSimpleFunction(const String& functionName);
    141140        InspectorController* m_inspectorController;
Note: See TracChangeset for help on using the changeset viewer.