Changeset 53046 in webkit


Ignore:
Timestamp:
Jan 9, 2010 6:36:26 PM (14 years ago)
Author:
abarth@webkit.org
Message:

2010-01-09 Adam Barth <abarth@webkit.org>

Reviewed by Darin Adler.

ScriptController::isEnabled needs to be renamed
https://bugs.webkit.org/show_bug.cgi?id=32063

Rename ScriptController::isEnabled to
ScriptController::canExecuteScripts to reflect what the method actually
means. This is a trivial change, but it involved touching a lot of
call sites.

  • WebCore.PluginHostProcess.exp:
  • bindings/ScriptControllerBase.cpp: (WebCore::ScriptController::canExecuteScripts): (WebCore::ScriptController::executeScript):
  • bindings/js/JSEventListener.cpp: (WebCore::JSEventListener::handleEvent):
  • bindings/js/JSLazyEventListener.cpp: (WebCore::JSLazyEventListener::parseCode):
  • bindings/js/ScheduledAction.cpp: (WebCore::ScheduledAction::execute):
  • bindings/js/ScriptController.cpp: (WebCore::ScriptController::bindingRootObject): (WebCore::ScriptController::windowScriptNPObject): (WebCore::ScriptController::jsObjectForPluginElement): (WebCore::ScriptController::executeScriptInWorld):
  • bindings/js/ScriptController.h:
  • bindings/js/ScriptControllerMac.mm: (WebCore::ScriptController::windowScriptObject):
  • bindings/js/ScriptEventListener.cpp: (WebCore::createAttributeEventListener):
  • bindings/js/ScriptState.cpp: (WebCore::scriptStateFromNode):
  • bindings/v8/ScriptController.cpp: (WebCore::ScriptController::windowScriptNPObject): (WebCore::ScriptController::createScriptObjectForPluginElement):
  • bindings/v8/ScriptController.h:
  • bindings/v8/ScriptEventListener.cpp: (WebCore::createAttributeEventListener):
  • bindings/v8/V8Proxy.cpp: (WebCore::V8Proxy::retrieve):
  • dom/ScriptElement.cpp: (WebCore::ScriptElementData::evaluateScript):
  • dom/XMLTokenizerLibxml2.cpp: (WebCore::XMLTokenizer::startElementNs):
  • html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::controls):
  • html/HTMLTokenizer.cpp: (WebCore::HTMLTokenizer::parseTag): (WebCore::HTMLTokenizer::processToken):
  • inspector/InspectorController.cpp: (WebCore::canPassNodeToJavaScript):
  • inspector/JavaScriptDebugServer.cpp: (WebCore::JavaScriptDebugServer::setJavaScriptPaused):
  • loader/FrameLoader.cpp: (WebCore::FrameLoader::isProcessingUserGesture): (WebCore::FrameLoader::open): (WebCore::FrameLoader::dispatchDidClearWindowObjectsInAllWorlds): (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):

2010-01-09 Adam Barth <abarth@webkit.org>

Reviewed by Darin Adler.

ScriptController::isEnabled needs to be renamed
https://bugs.webkit.org/show_bug.cgi?id=32063

Rename ScriptController::isEnabled to
ScriptController::canExecuteScripts.

  • src/WebFrameImpl.cpp: (WebKit::WebFrameImpl::bindToWindowObject):

2010-01-09 Adam Barth <abarth@webkit.org>

Reviewed by Darin Adler.

ScriptController::isEnabled needs to be renamed
https://bugs.webkit.org/show_bug.cgi?id=32063

Rename ScriptController::isEnabled to
ScriptController::canExecuteScripts.

  • Plugins/Hosted/NetscapePluginInstanceProxy.mm: (WebKit::NetscapePluginInstanceProxy::getWindowNPObject): (WebKit::NetscapePluginInstanceProxy::demarshalValueFromArray):

2010-01-09 Adam Barth <abarth@webkit.org>

Reviewed by Darin Adler.

ScriptController::isEnabled needs to be renamed
https://bugs.webkit.org/show_bug.cgi?id=32063

Rename ScriptController::isEnabled to
ScriptController::canExecuteScripts.

  • WebFrame.cpp: (wxWebFrame::RunScript):
Location:
trunk
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r53042 r53046  
     12010-01-09  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        ScriptController::isEnabled needs to be renamed
     6        https://bugs.webkit.org/show_bug.cgi?id=32063
     7
     8        Rename ScriptController::isEnabled to
     9        ScriptController::canExecuteScripts to reflect what the method actually
     10        means.  This is a trivial change, but it involved touching a lot of
     11        call sites.
     12
     13        * WebCore.PluginHostProcess.exp:
     14        * bindings/ScriptControllerBase.cpp:
     15        (WebCore::ScriptController::canExecuteScripts):
     16        (WebCore::ScriptController::executeScript):
     17        * bindings/js/JSEventListener.cpp:
     18        (WebCore::JSEventListener::handleEvent):
     19        * bindings/js/JSLazyEventListener.cpp:
     20        (WebCore::JSLazyEventListener::parseCode):
     21        * bindings/js/ScheduledAction.cpp:
     22        (WebCore::ScheduledAction::execute):
     23        * bindings/js/ScriptController.cpp:
     24        (WebCore::ScriptController::bindingRootObject):
     25        (WebCore::ScriptController::windowScriptNPObject):
     26        (WebCore::ScriptController::jsObjectForPluginElement):
     27        (WebCore::ScriptController::executeScriptInWorld):
     28        * bindings/js/ScriptController.h:
     29        * bindings/js/ScriptControllerMac.mm:
     30        (WebCore::ScriptController::windowScriptObject):
     31        * bindings/js/ScriptEventListener.cpp:
     32        (WebCore::createAttributeEventListener):
     33        * bindings/js/ScriptState.cpp:
     34        (WebCore::scriptStateFromNode):
     35        * bindings/v8/ScriptController.cpp:
     36        (WebCore::ScriptController::windowScriptNPObject):
     37        (WebCore::ScriptController::createScriptObjectForPluginElement):
     38        * bindings/v8/ScriptController.h:
     39        * bindings/v8/ScriptEventListener.cpp:
     40        (WebCore::createAttributeEventListener):
     41        * bindings/v8/V8Proxy.cpp:
     42        (WebCore::V8Proxy::retrieve):
     43        * dom/ScriptElement.cpp:
     44        (WebCore::ScriptElementData::evaluateScript):
     45        * dom/XMLTokenizerLibxml2.cpp:
     46        (WebCore::XMLTokenizer::startElementNs):
     47        * html/HTMLMediaElement.cpp:
     48        (WebCore::HTMLMediaElement::controls):
     49        * html/HTMLTokenizer.cpp:
     50        (WebCore::HTMLTokenizer::parseTag):
     51        (WebCore::HTMLTokenizer::processToken):
     52        * inspector/InspectorController.cpp:
     53        (WebCore::canPassNodeToJavaScript):
     54        * inspector/JavaScriptDebugServer.cpp:
     55        (WebCore::JavaScriptDebugServer::setJavaScriptPaused):
     56        * loader/FrameLoader.cpp:
     57        (WebCore::FrameLoader::isProcessingUserGesture):
     58        (WebCore::FrameLoader::open):
     59        (WebCore::FrameLoader::dispatchDidClearWindowObjectsInAllWorlds):
     60        (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
     61
    1622010-01-09  Evan Martin  <evan@chromium.org>
    263
  • trunk/WebCore/WebCore.PluginHostProcess.exp

    r48686 r53046  
    1010__ZN7WebCore13IdentifierRep7isValidEPS0_
    1111__ZN7WebCore16ScriptController16createRootObjectEPv
     12__ZN7WebCore16ScriptController17canExecuteScriptsEv
    1213__ZN7WebCore16ScriptController24jsObjectForPluginElementEPNS_17HTMLPlugInElementE
    13 __ZN7WebCore16ScriptController9isEnabledEv
    1414__ZN7WebCore6String26fromUTF8WithLatin1FallbackEPKcm
    1515__ZN7WebCore6String8fromUTF8EPKcm
  • trunk/WebCore/bindings/ScriptControllerBase.cpp

    r52882 r53046  
    2323
    2424#include "Frame.h"
     25#include "FrameLoaderClient.h"
    2526#include "Page.h"
    2627#include "ScriptSourceCode.h"
     
    3132namespace WebCore {
    3233
     34bool ScriptController::canExecuteScripts()
     35{
     36    if (m_frame->loader()->isSandboxed(SandboxScripts))
     37        return false;
     38
     39    Settings* settings = m_frame->settings();
     40    return m_frame->loader()->client()->allowJavaScript(settings && settings->isJavaScriptEnabled());
     41}
     42
    3343ScriptValue ScriptController::executeScript(const String& script, bool forceUserGesture)
    3444{
     
    3848ScriptValue ScriptController::executeScript(const ScriptSourceCode& sourceCode)
    3949{
    40     if (!isEnabled() || isPaused())
     50    if (!canExecuteScripts() || isPaused())
    4151        return ScriptValue();
    4252
  • trunk/WebCore/bindings/js/JSEventListener.cpp

    r51512 r53046  
    8282        // FIXME: Is this check needed for other contexts?
    8383        ScriptController* script = frame->script();
    84         if (!script->isEnabled() || script->isPaused())
     84        if (!script->canExecuteScripts() || script->isPaused())
    8585            return;
    8686    }
  • trunk/WebCore/bindings/js/JSLazyEventListener.cpp

    r49963 r53046  
    9090
    9191    ScriptController* scriptController = frame->script();
    92     if (!scriptController->isEnabled())
     92    if (!scriptController->canExecuteScripts())
    9393        return;
    9494
     
    111111        // FIXME: Is this check needed for non-Document contexts?
    112112        ScriptController* script = frame->script();
    113         if (!script->isEnabled() || script->isPaused())
     113        if (!script->canExecuteScripts() || script->isPaused())
    114114            return;
    115115    }
  • trunk/WebCore/bindings/js/ScheduledAction.cpp

    r51512 r53046  
    118118
    119119    RefPtr<Frame> frame = window->impl()->frame();
    120     if (!frame || !frame->script()->isEnabled())
     120    if (!frame || !frame->script()->canExecuteScripts())
    121121        return;
    122122
  • trunk/WebCore/bindings/js/ScriptController.cpp

    r52882 r53046  
    287287}
    288288
    289 bool ScriptController::isEnabled()
    290 {
    291     Settings* settings = m_frame->settings();
    292     return m_frame->loader()->client()->allowJavaScript(settings && settings->isJavaScriptEnabled() && !m_frame->loader()->isSandboxed(SandboxScripts));
    293 }
    294 
    295289void ScriptController::attachDebugger(JSC::Debugger* debugger)
    296290{
     
    324318Bindings::RootObject* ScriptController::bindingRootObject()
    325319{
    326     if (!isEnabled())
     320    if (!canExecuteScripts())
    327321        return 0;
    328322
     
    351345{
    352346    if (!m_windowScriptNPObject) {
    353         if (isEnabled()) {
     347        if (canExecuteScripts()) {
    354348            // JavaScript is enabled, so there is a JavaScript window object.
    355349            // Return an NPObject bound to the window object.
     
    384378{
    385379    // Can't create JSObjects when JavaScript is disabled
    386     if (!isEnabled())
     380    if (!canExecuteScripts())
    387381        return 0;
    388382
     
    451445    ScriptSourceCode sourceCode(script, forceUserGesture ? KURL() : m_frame->loader()->url());
    452446
    453     if (!isEnabled() || isPaused())
     447    if (!canExecuteScripts() || isPaused())
    454448        return ScriptValue();
    455449
  • trunk/WebCore/bindings/js/ScriptController.h

    r50973 r53046  
    111111    bool anyPageIsProcessingUserGesture() const;
    112112
    113     bool isEnabled();
     113    bool canExecuteScripts();
    114114
    115115    void attachDebugger(JSC::Debugger*);
  • trunk/WebCore/bindings/js/ScriptControllerMac.mm

    r49963 r53046  
    109109WebScriptObject* ScriptController::windowScriptObject()
    110110{
    111     if (!isEnabled())
     111    if (!canExecuteScripts())
    112112        return 0;
    113113
  • trunk/WebCore/bindings/js/ScriptEventListener.cpp

    r49963 r53046  
    6060    if (Frame* frame = node->document()->frame()) {
    6161        ScriptController* scriptController = frame->script();
    62         if (!scriptController->isEnabled())
     62        if (!scriptController->canExecuteScripts())
    6363            return 0;
    6464
     
    8484   
    8585    ScriptController* scriptController = frame->script();
    86     if (!scriptController->isEnabled())
     86    if (!scriptController->canExecuteScripts())
    8787        return 0;
    8888
  • trunk/WebCore/bindings/js/ScriptState.cpp

    r51512 r53046  
    4949    if (!frame)
    5050        return 0;
    51     if (!frame->script()->isEnabled())
     51    if (!frame->script()->canExecuteScripts())
    5252        return 0;
    5353    return frame->script()->globalObject(world)->globalExec();
  • trunk/WebCore/bindings/v8/ScriptController.cpp

    r52937 r53046  
    295295}
    296296
    297 bool ScriptController::isEnabled() const
    298 {
    299     Settings* settings = m_proxy->frame()->settings();
    300     return m_proxy->frame()->loader()->client()->allowJavaScript(settings && settings->isJavaScriptEnabled() && !m_frame->loader()->isSandboxed(SandboxScripts));
    301 }
    302 
    303297PassScriptInstance ScriptController::createScriptInstanceForWidget(Widget* widget)
    304298{
     
    402396        return m_windowScriptNPObject;
    403397
    404     if (isEnabled()) {
     398    if (canExecuteScripts()) {
    405399        // JavaScript is enabled, so there is a JavaScript window object.
    406400        // Return an NPObject bound to the window object.
     
    419413{
    420414    // Can't create NPObjects when JavaScript is disabled.
    421     if (!isEnabled())
     415    if (!canExecuteScripts())
    422416        return createNoScriptObject();
    423417
  • trunk/WebCore/bindings/v8/ScriptController.h

    r52937 r53046  
    113113    bool haveInterpreter() const;
    114114
    115     bool isEnabled() const;
     115    bool canExecuteScripts();
    116116
    117117    // FIXME: void* is a compile hack.
  • trunk/WebCore/bindings/v8/ScriptEventListener.cpp

    r51960 r53046  
    5353    if (Frame* frame = node->document()->frame()) {
    5454        ScriptController* scriptController = frame->script();
    55         if (!scriptController->isEnabled())
     55        if (!scriptController->canExecuteScripts())
    5656            return 0;
    5757
     
    8282
    8383    ScriptController* scriptController = frame->script();
    84     if (!scriptController->isEnabled())
     84    if (!scriptController->canExecuteScripts())
    8585        return 0;
    8686
  • trunk/WebCore/bindings/v8/V8Proxy.cpp

    r52938 r53046  
    548548    if (!frame)
    549549        return 0;
    550     return frame->script()->isEnabled() ? frame->script()->proxy() : 0;
     550    return frame->script()->canExecuteScripts() ? frame->script()->proxy() : 0;
    551551}
    552552
  • trunk/WebCore/dom/ScriptElement.cpp

    r51097 r53046  
    178178
    179179    if (Frame* frame = m_element->document()->frame()) {
    180         if (!frame->script()->isEnabled())
     180        if (!frame->script()->canExecuteScripts())
    181181            return;
    182182
  • trunk/WebCore/dom/XMLTokenizerLibxml2.cpp

    r52491 r53046  
    784784
    785785    ScriptController* jsProxy = m_doc->frame() ? m_doc->frame()->script() : 0;
    786     if (jsProxy && m_doc->frame()->script()->isEnabled())
     786    if (jsProxy && m_doc->frame()->script()->canExecuteScripts())
    787787        jsProxy->setEventHandlerLineNumber(lineNumber());
    788788
  • trunk/WebCore/html/HTMLMediaElement.cpp

    r52947 r53046  
    11531153
    11541154    // always show controls when scripting is disabled
    1155     if (frame && !frame->script()->isEnabled())
     1155    if (frame && !frame->script()->canExecuteScripts())
    11561156        return true;
    11571157
  • trunk/WebCore/html/HTMLTokenizer.cpp

    r52116 r53046  
    15021502                m_scriptTagCharsetAttrValue = String();
    15031503                if (m_currentToken.attrs && !m_fragment) {
    1504                     if (m_doc->frame() && m_doc->frame()->script()->isEnabled()) {
     1504                    if (m_doc->frame() && m_doc->frame()->script()->canExecuteScripts()) {
    15051505                        if ((a = m_currentToken.attrs->getAttributeItem(srcAttr)))
    15061506                            m_scriptTagSrcAttrValue = m_doc->completeURL(deprecatedParseURL(a->value())).string();
     
    19121912{
    19131913    ScriptController* scriptController = (!m_fragment && m_doc->frame()) ? m_doc->frame()->script() : 0;
    1914     if (scriptController && scriptController->isEnabled())
     1914    if (scriptController && scriptController->canExecuteScripts())
    19151915        // FIXME: Why isn't this m_currentScriptTagStartLineNumber?  I suspect this is wrong.
    19161916        scriptController->setEventHandlerLineNumber(m_currentTagStartLineNumber + 1); // Script line numbers are 1 based.
  • trunk/WebCore/inspector/InspectorController.cpp

    r52547 r53046  
    230230        return false;
    231231    Frame* frame = node->document()->frame();
    232     return frame && frame->script()->isEnabled();
     232    return frame && frame->script()->canExecuteScripts();
    233233}
    234234
  • trunk/WebCore/inspector/JavaScriptDebugServer.cpp

    r48774 r53046  
    424424    ASSERT_ARG(frame, frame);
    425425
    426     if (!frame->script()->isEnabled())
     426    if (!frame->script()->canExecuteScripts())
    427427        return;
    428428
  • trunk/WebCore/loader/FrameLoader.cpp

    r52456 r53046  
    14531453{
    14541454    Frame* frame = m_frame->tree()->top();
    1455     if (!frame->script()->isEnabled())
     1455    if (!frame->script()->canExecuteScripts())
    14561456        return true; // If JavaScript is disabled, a user gesture must have initiated the navigation.
    14571457    return frame->script()->processingUserGesture(); // FIXME: Use pageIsProcessingUserGesture.
     
    26602660   
    26612661    // Delete old status bar messages (if it _was_ activated on last URL).
    2662     if (m_frame->script()->isEnabled()) {
     2662    if (m_frame->script()->canExecuteScripts()) {
    26632663        m_frame->setJSStatusBarText(String());
    26642664        m_frame->setJSDefaultStatusBarText(String());
     
    38793879void FrameLoader::dispatchDidClearWindowObjectsInAllWorlds()
    38803880{
    3881     if (!m_frame->script()->isEnabled())
     3881    if (!m_frame->script()->canExecuteScripts())
    38823882        return;
    38833883
     
    38903890void FrameLoader::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* world)
    38913891{
    3892     if (!m_frame->script()->isEnabled() || !m_frame->script()->existingWindowShell(world))
     3892    if (!m_frame->script()->canExecuteScripts() || !m_frame->script()->existingWindowShell(world))
    38933893        return;
    38943894
  • trunk/WebKit/chromium/ChangeLog

    r53036 r53046  
     12010-01-09  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        ScriptController::isEnabled needs to be renamed
     6        https://bugs.webkit.org/show_bug.cgi?id=32063
     7
     8        Rename ScriptController::isEnabled to
     9        ScriptController::canExecuteScripts.
     10
     11        * src/WebFrameImpl.cpp:
     12        (WebKit::WebFrameImpl::bindToWindowObject):
     13
    1142010-01-08  Daniel Bates  <dbates@webkit.org>
    215
  • trunk/WebKit/chromium/src/WebFrameImpl.cpp

    r52851 r53046  
    598598{
    599599    ASSERT(m_frame);
    600     if (!m_frame || !m_frame->script()->isEnabled())
     600    if (!m_frame || !m_frame->script()->canExecuteScripts())
    601601        return;
    602602
  • trunk/WebKit/mac/ChangeLog

    r52972 r53046  
     12010-01-09  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        ScriptController::isEnabled needs to be renamed
     6        https://bugs.webkit.org/show_bug.cgi?id=32063
     7
     8        Rename ScriptController::isEnabled to
     9        ScriptController::canExecuteScripts.
     10
     11        * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
     12        (WebKit::NetscapePluginInstanceProxy::getWindowNPObject):
     13        (WebKit::NetscapePluginInstanceProxy::demarshalValueFromArray):
     14
    1152010-01-07  Daniel Bates  <dbates@rim.com>
    216
  • trunk/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm

    r52619 r53046  
    697697        return false;
    698698   
    699     if (!frame->script()->isEnabled())
     699    if (!frame->script()->canExecuteScripts())
    700700        objectID = 0;
    701701    else
     
    12021202                return false;
    12031203           
    1204             if (!frame->script()->isEnabled())
     1204            if (!frame->script()->canExecuteScripts())
    12051205                return false;
    12061206
  • trunk/WebKit/wx/ChangeLog

    r52668 r53046  
     12010-01-09  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        ScriptController::isEnabled needs to be renamed
     6        https://bugs.webkit.org/show_bug.cgi?id=32063
     7
     8        Rename ScriptController::isEnabled to
     9        ScriptController::canExecuteScripts.
     10
     11        * WebFrame.cpp:
     12        (wxWebFrame::RunScript):
     13
    1142009-12-30  Kevin Watters  <kevinwatters@gmail.com>
    215
  • trunk/WebKit/wx/WebFrame.cpp

    r52420 r53046  
    195195        if (hasLoaded) {
    196196            WebCore::ScriptController* controller = m_impl->frame->script();
    197             bool jsEnabled = controller->isEnabled();
     197            bool jsEnabled = controller->canExecuteScripts();
    198198            wxASSERT_MSG(jsEnabled, wxT("RunScript requires JavaScript to be enabled."));
    199199            if (jsEnabled) {
Note: See TracChangeset for help on using the changeset viewer.