• timothy@apple.com's avatar
    Made the starting line number of scripts be 1-based throughout the engine. · 82a000d6
    timothy@apple.com authored
    JavaScriptCore:
    
    2008-05-30  Timothy Hatcher  <timothy@apple.com>
    
            Made the starting line number of scripts be 1-based throughout the engine.
            This cleans up script line numbers so they are all consistent now and fixes
            some cases where script execution was shown as off by one line in the debugger.
    
            No change in SunSpider.
    
            Reviewed by Oliver Hunt.
    
            * API/minidom.c:
            (main): Pass a line number of 1 instead of 0 to parser().parse().
            * API/testapi.c:
            (main): Ditto. And removes a FIXME and changed an assertEqualsAsNumber
            to use 1 instead of 2 for the line number.
            * VM/Machine.cpp:
            (KJS::callEval): Pass a line number of 1 instead of 0.
            (KJS::Machine::debug): Use firstLine for WillExecuteProgram instead of
            lastLine. Use lastLine for DidExecuteProgram instead of firstLine.
            * kjs/DebuggerCallFrame.cpp:
            (KJS::DebuggerCallFrame::evaluate): Pass a line number of 1 instead of
            0 to parser().parse().
            * kjs/Parser.cpp:
            (KJS::Parser::parse): ASSERT startingLineNumber is greatter than 0. Change
            the startingLineNumber to be 1 if it was less than or equal to 0. This is needed
            for release builds to maintain compatibility with the JavaScriptCore API.
            * kjs/function.cpp:
            (KJS::globalFuncEval): Pass a line number of 1 instead of 0 to parser().parse().
            * kjs/function_object.cpp:
            (FunctionObjectImp::construct): Pass a line number of 1 instead of 0 to construct().
            * kjs/lexer.cpp:
            (Lexer::setCode): Made yylineno = startingLineNumber instead of adding 1.
            * kjs/testkjs.cpp:
            (functionRun): Pass a line number of 1 instead of 0 to Interpreter::evaluate().
            (functionLoad): Ditto.
            (prettyPrintScript): Ditto.
            (runWithScripts): Ditto.
            * profiler/Profiler.cpp:
            (WebCore::createCallIdentifier): Removed a plus 1 of startingLineNumber.
    
    WebCore:
    
    2008-05-30  Timothy Hatcher  <timothy@apple.com>
    
            Made the starting line number of scripts be 1-based throughout the engine.
            This cleans up script line numbers so they are all consistent now and fixes
            some cases where script execution was shown as off by one line in the debugger.
    
            Doing this also exposed a bug where JSLazyEventListener created in XHML or SVG
            documents would always have a line number of 0. So this change fixed that bug
            to pass all the SVG and XHTML tests.
    
            All layout tests pass.
    
            Reviewed by Oliver Hunt.
    
            * bindings/js/kjs_events.cpp:
            (WebCore::JSLazyEventListener::JSLazyEventListener): Set the line number to 1
            if it was passed in as 0. This can happen when listeners are created with
            a setAttribute call from JavaScript.
            (WebCore::JSLazyEventListener::parseCode): Add a FIXME about the URL being
            incorrect when listeners are created with a setAttribute call from JavaScript.
            * bindings/js/kjs_events.h: Remove the default value for lineNumber, since no
            callers need it.
            * bindings/objc/WebScriptObject.mm:
            (-[WebScriptObject evaluateWebScript:]): Pass a line number of 1 instead of 0
            to Interpreter::evaluate().
            * bridge/NP_jsobject.cpp:
            (_NPN_Evaluate): Ditto.
            * bridge/jni/jni_jsobject.mm:
            (JavaJSObject::eval): Ditto.
            * dom/XMLTokenizer.cpp:
            (WebCore::XMLTokenizer::startElementNs): Call KJSProxy::setEventHandlerLineno()
            around the call to handleElementAttributes, so any JSLazyEventListener created
            from those attributes have line numbers.
            (WebCore::XMLTokenizer::endElementNs): Remove a minus 1 of the line number.
            (WebCore::XMLTokenizer::notifyFinished): Pass a line number of 1 instead of 0.
            (WebCore::XMLTokenizer::parseEndElement): Remove a minus 1 of the line number.
            * html/HTMLScriptElement.cpp:
            (WebCore::HTMLScriptElement::evaluateScript): Add a FIXME about the starting
            line number being incorrect in some cases when this function is called.
            * html/HTMLTokenizer.cpp:
            (WebCore::HTMLTokenizer::parseSpecial): Add a plus 1 to the line number when
            setting scriptStartLineno so it is 1-based. Same for calling setEventHandlerLineno().
            (WebCore::HTMLTokenizer::processToken): Ditto.
            * html/HTMLTokenizer.h: Change the default line number on scriptExecution() to 1 from 0.
            * loader/FrameLoader.cpp:
            (FrameLoader::executeIfJavaScriptURL): Pass a line number of 1 instead of 0 to executeScript().
    
    WebKitTools:
    
    2008-05-30  Timothy Hatcher  <timothy@apple.com>
    
            Made the starting line number of scripts be 1-based throughout the engine.
            This cleans up script line numbers so they are all consistent now.
    
            Reviewed by Oliver Hunt.
    
            * DumpRenderTree/mac/ObjCController.m:
            (runJavaScriptThread): Pass a line number of 1 instead of 0 to JSEvaluateScript.
            * DumpRenderTree/pthreads/JavaScriptThreadingPthreads.cpp:
            (runJavaScriptThread): Ditto.
            * DumpRenderTree/win/DumpRenderTree.cpp:
            (runJavaScriptThread): Ditto.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34273 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    82a000d6
kjs_events.cpp 10.2 KB