Changeset 31197 in webkit


Ignore:
Timestamp:
Mar 20, 2008 5:13:56 PM (16 years ago)
Author:
Adam Roben
Message:

Allow blocking of JS event handlers/javascript: URIs per-Frame

Part of Bug 17133: Should support pausing JavaScript execution without
hanging the process

<http://bugs.webkit.org/show_bug.cgi?id=17133>
<rdar://problem/5719551>

Two new methods are added to KJSProxy: setPaused and isPaused. When
setPaused(true) is called, JS event handlers are blocked and
javascript: URIs will not be evaluated.

Reviewed by Tim Hatcher.

  • bindings/js/kjs_events.cpp: (WebCore::JSAbstractEventListener::handleEvent):
    • Removed some old KJS_DEBUGGER code
    • Don't run the handler if the KJSProxy is paused.
  • bindings/js/kjs_proxy.cpp: (WebCore::KJSProxy::KJSProxy): Initialize new member.
  • bindings/js/kjs_proxy.h: Added new methods.
  • loader/FrameLoader.cpp: (WebCore::FrameLoader::executeScript): Don't execute the script if the KJSProxy is paused.
Location:
trunk/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r31196 r31197  
     12008-03-20  Adam Roben  <aroben@apple.com>
     2
     3        Allow blocking of JS event handlers/javascript: URIs per-Frame
     4
     5        Part of Bug 17133: Should support pausing JavaScript execution without
     6        hanging the process
     7
     8        <http://bugs.webkit.org/show_bug.cgi?id=17133>
     9        <rdar://problem/5719551>
     10
     11        Two new methods are added to KJSProxy: setPaused and isPaused. When
     12        setPaused(true) is called, JS event handlers are blocked and
     13        javascript: URIs will not be evaluated.
     14
     15        Reviewed by Tim Hatcher.
     16
     17        * bindings/js/kjs_events.cpp:
     18        (WebCore::JSAbstractEventListener::handleEvent):
     19          - Removed some old KJS_DEBUGGER code
     20          - Don't run the handler if the KJSProxy is paused.
     21        * bindings/js/kjs_proxy.cpp:
     22        (WebCore::KJSProxy::KJSProxy): Initialize new member.
     23        * bindings/js/kjs_proxy.h: Added new methods.
     24        * loader/FrameLoader.cpp:
     25        (WebCore::FrameLoader::executeScript): Don't execute the script if the
     26        KJSProxy is paused.
     27
    1282008-03-20  Jon Honeycutt  <jhoneycutt@apple.com>
    229
  • trunk/WebCore/bindings/js/kjs_events.cpp

    r30787 r31197  
    4949void JSAbstractEventListener::handleEvent(Event* ele, bool isWindowEvent)
    5050{
    51 #ifdef KJS_DEBUGGER
    52     if (KJSDebugWin::instance() && KJSDebugWin::instance()->inSession())
    53         return;
    54 #endif
    55 
    5651    Event* event = ele;
    5752
     
    6863    if (!frame)
    6964        return;
    70     if (!frame->scriptProxy()->isEnabled())
     65    KJSProxy* scriptProxy = frame->scriptProxy();
     66    if (!scriptProxy->isEnabled() || scriptProxy->isPaused())
    7167        return;
    7268
    7369    JSLock lock;
    7470
    75     JSGlobalObject* globalObject = frame->scriptProxy()->globalObject();
     71    JSGlobalObject* globalObject = scriptProxy->globalObject();
    7672    ExecState* exec = globalObject->globalExec();
    7773
  • trunk/WebCore/bindings/js/kjs_proxy.cpp

    r30942 r31197  
    5050    , m_processingTimerCallback(0)
    5151    , m_processingInlineCode(0)
     52    , m_paused(false)
    5253{
    5354}
  • trunk/WebCore/bindings/js/kjs_proxy.h

    r30764 r31197  
    7171    void attachDebugger(KJS::Debugger*);
    7272
     73    void setPaused(bool b) { m_paused = b; }
     74    bool isPaused() const { return m_paused; }
     75
    7376private:
    7477    void initScriptIfNeeded()
     
    8588    bool m_processingTimerCallback;
    8689    bool m_processingInlineCode;
     90    bool m_paused;
    8791};
    8892
  • trunk/WebCore/loader/FrameLoader.cpp

    r31083 r31197  
    757757JSValue* FrameLoader::executeScript(const String& url, int baseLine, const String& script)
    758758{
    759     if (!m_frame->scriptProxy()->isEnabled())
     759    KJSProxy* scriptProxy = m_frame->scriptProxy();
     760
     761    if (!scriptProxy->isEnabled() || scriptProxy->isPaused())
    760762        return 0;
    761763
Note: See TracChangeset for help on using the changeset viewer.