Reviewed by Darin.
authoralice.liu@apple.com <alice.liu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Feb 2008 23:18:25 +0000 (23:18 +0000)
committeralice.liu@apple.com <alice.liu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Feb 2008 23:18:25 +0000 (23:18 +0000)
commitf7f10efec3459f8d2d6ca0e51629310a719920e0
treede349370b5e05b6d2e33398d39cb49d8d3f84edf
parentd7e291765d2f27b156ef18538cf9cd352a000d55
    Reviewed by Darin.

        Fixed <rdar://problem/5741440> REGRESSION (r28496): After deactivating JavaScript, scripts embedded in the HTML page continue to run

        Before this patch, Frame::scriptProxy() would only return null in the case that javascript was
        disabled and if the script proxy field wasn't set (which would only be the case if the window
        hasn't loaded anything yet).  Not all callers of scriptProxy() always check for a non-null return
        value.  Those that did check would effectively be checking if javascript was enabled before proceeding.
        This fix consists of 2 elements: first, make sure that scriptProxy() will never return null, regardless
        of whether javascript is disabled.  This will mean that callers who don't check for null won't crash.
        Second, callers who did check for null now instead check for javascript being disabled.  This means that
        code paths intended for preventing javascript from being run will be making the correct check.  Another
        minor addition to this patch is that I added a function on Frame to be a shortcut for checking if javascript
        is enabled.

        * bindings/js/JSCustomSQLStatementCallback.cpp:
        (WebCore::JSCustomSQLStatementCallback::handleEvent):
        * bindings/js/JSCustomSQLStatementErrorCallback.cpp:
        (WebCore::JSCustomSQLStatementErrorCallback::handleEvent):
        * bindings/js/JSCustomSQLTransactionCallback.cpp:
        (WebCore::JSCustomSQLTransactionCallback::handleEvent):
        * bindings/js/JSCustomSQLTransactionErrorCallback.cpp:
        (WebCore::JSCustomSQLTransactionErrorCallback::handleEvent):
        * bindings/js/JSCustomVoidCallback.cpp:
        (WebCore::JSCustomVoidCallback::handleEvent):
        * bindings/js/JSCustomXPathNSResolver.cpp:
        (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
        * bindings/js/ScheduledAction.cpp:
        (WebCore::ScheduledAction::execute):
        * bindings/js/kjs_events.cpp:
        (WebCore::JSAbstractEventListener::handleEvent):
        (WebCore::JSLazyEventListener::parseCode):
        * bindings/js/kjs_html.cpp:
        (WebCore::runtimeObjectImplementsCall):
        * bindings/js/kjs_proxy.cpp:
        (WebCore::KJSProxy::isEnabled):
        * bindings/js/kjs_proxy.h:
        * bindings/js/kjs_window.cpp:
        (KJS::Window::retrieveWindow):
        (KJS::Window::retrieve):
        * dom/Document.cpp:
        (WebCore::Document::createHTMLEventListener):
        * dom/EventTarget.cpp:
        (WebCore::EventTarget::dispatchGenericEvent):
        * html/HTMLPlugInElement.cpp:
        (WebCore::HTMLPlugInElement::createNPObject):
        * html/HTMLScriptElement.cpp:
        (WebCore::HTMLScriptElement::evaluateScript):
        * html/HTMLTokenizer.cpp:
        (WebCore::HTMLTokenizer::parseTag):
        (WebCore::HTMLTokenizer::processToken):
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::executeScript):
        (WebCore::FrameLoader::userGestureHint):
        (WebCore::FrameLoader::open):
        (WebCore::FrameLoader::dispatchWindowObjectAvailable):
        (WebCore::FrameLoader::switchOutLowBandwidthDisplayIfReady):
        * manual-tests/disable-javascript-reload.html: Added.
        * page/Frame.cpp:
        (WebCore::Frame::scriptProxy):
        (WebCore::Frame::bindingRootObject):
        (WebCore::Frame::windowScriptNPObject):
        * page/Frame.h:
        * page/InspectorController.cpp:
        (WebCore::canPassNodeToJavaScript):
        * page/mac/FrameMac.mm:
        (WebCore::Frame::windowScriptObject):
        * svg/SVGDocumentExtensions.cpp:
        (WebCore::SVGDocumentExtensions::createSVGEventListener):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@30325 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
WebCore/ChangeLog
WebCore/bindings/js/JSCustomSQLStatementCallback.cpp
WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp
WebCore/bindings/js/JSCustomSQLTransactionCallback.cpp
WebCore/bindings/js/JSCustomSQLTransactionErrorCallback.cpp
WebCore/bindings/js/JSCustomVoidCallback.cpp
WebCore/bindings/js/JSCustomXPathNSResolver.cpp
WebCore/bindings/js/ScheduledAction.cpp
WebCore/bindings/js/kjs_events.cpp
WebCore/bindings/js/kjs_html.cpp
WebCore/bindings/js/kjs_proxy.cpp
WebCore/bindings/js/kjs_proxy.h
WebCore/bindings/js/kjs_window.cpp
WebCore/dom/Document.cpp
WebCore/dom/EventTarget.cpp
WebCore/html/HTMLPlugInElement.cpp
WebCore/html/HTMLScriptElement.cpp
WebCore/html/HTMLTokenizer.cpp
WebCore/loader/FrameLoader.cpp
WebCore/manual-tests/disable-javascript-reload.html [new file with mode: 0644]
WebCore/page/Frame.cpp
WebCore/page/InspectorController.cpp
WebCore/page/mac/FrameMac.mm
WebCore/svg/SVGDocumentExtensions.cpp