Ignore:
Timestamp:
Dec 16, 2005, 12:08:23 AM (19 years ago)
Author:
darin
Message:

JavaScriptCore:

Reviewed by Maciej.

  • kjs/internal.h:
  • kjs/internal.cpp: (KJS::InterpreterImp::evaluate): Change to take a character pointer and length rather than a UString.
  • kjs/interpreter.h:
  • kjs/interpreter.cpp: (Interpreter::evaluate): Ditto.
  • kjs/protect.h: Remove uneeded "convert to bool" operator since we already have a "convert to raw pointer" operator in this class.

WebCore:

Reviewed by Maciej.

  • khtml/ecma/kjs_dom.cpp: (KJS::DOMNode::getListener): Use listenerObj instead of listenerObjImp.
  • khtml/ecma/kjs_html.cpp: (KJS::Image::getValueProperty): Ditto.
  • khtml/ecma/xmlhttprequest.cpp: (KJS::XMLHttpRequest::getValueProperty): Ditto.
  • khtml/ecma/kjs_window.h:
  • khtml/ecma/kjs_window.cpp: (KJS::Window::getListener): Ditto. (KJS::Window::getJSLazyEventListener): Take code as a DOMString, not QString.
  • khtml/ecma/kjs_events.cpp: (KJS::jsStringOrUndefined): Renamed function and moved it to the top of the file. (KJS::JSAbstractEventListener::handleEvent): Cleaned up function, removed double logging, and fixed code path to not use UString::ascii(). (KJS::JSUnprotectedEventListener::JSUnprotectedEventListener): Updated since type of the window object is now Window. (KJS::JSUnprotectedEventListener::~JSUnprotectedEventListener): Ditto. (KJS::JSUnprotectedEventListener::windowObj): Ditto. (KJS::JSEventListener::JSEventListener): Ditto. (KJS::JSEventListener::~JSEventListener): Ditto. (KJS::JSEventListener::windowObj): Ditto. (KJS::JSLazyEventListener::JSLazyEventListener): Ditto. Also changed code to be a DOMString instead of a QString. (KJS::JSLazyEventListener::handleEvent): Removed function because the base class handleEvent already calls listenerObj which takes care of parseCode -- no need to do an additional parseCode here. (KJS::JSLazyEventListener::parseCode): Rearrange and clean up a bit. Code is now a DOMString instead of a QString. (KJS::Clipboard::Clipboard): Remove explicit ref since we now use a RefPtr for the clipboard object. (KJS::Clipboard::getValueProperty): Update to call jsStringOrUndefined.
  • khtml/ecma/kjs_events.h: Reformatted the file. Changed windowObj functions to return Window* instead of ObjectImp*. Removed listenerObjImp function. Removed destructors from many classes that don't need them. Used a RefPtr for the ClipboardImpl in a Clipboard object.
  • khtml/ecma/kjs_proxy.h:
  • khtml/ecma/kjs_proxy.cpp: (KJSProxyImpl::evaluate): Take filename and code as DOMString instead of QString. (KJSProxyImpl::createHTMLEventHandler): Take URL and code as DOMString.
  • khtml/xml/dom_docimpl.h:
  • khtml/xml/dom_docimpl.cpp: (DocumentImpl::createHTMLEventListener): Take a DOMString rather than a QString for the JavaScript code. (DocumentImpl::setHTMLWindowEventListener): Added an overload that takes an attribute pointer. Calls through after extracting the code from the attribute value.
  • khtml/html/html_elementimpl.h:
  • khtml/html/html_elementimpl.cpp: (HTMLElementImpl::setHTMLEventListener): New version of function that takes an attribute pointer; calls through to the base class after extracting the code from the attribute value.
  • khtml/html/html_baseimpl.cpp: (HTMLBodyElementImpl::parseMappedAttribute): Change to use new setHTMLWindowEventListener and setHTMLEventListener that takes an attribute pointer. (HTMLFrameElementImpl::parseMappedAttribute): Ditto. (HTMLFrameSetElementImpl::parseMappedAttribute): Ditto.
  • khtml/html/html_elementimpl.cpp: (HTMLElementImpl::parseMappedAttribute): Ditto.
  • khtml/html/html_formimpl.cpp: (DOM::HTMLFormElementImpl::parseMappedAttribute): Ditto. (DOM::HTMLButtonElementImpl::parseMappedAttribute): Ditto. (DOM::HTMLInputElementImpl::parseMappedAttribute): Ditto. (DOM::HTMLLabelElementImpl::parseMappedAttribute): Ditto. (DOM::HTMLSelectElementImpl::parseMappedAttribute): Ditto. (DOM::HTMLTextAreaElementImpl::parseMappedAttribute): Ditto.
  • khtml/html/html_imageimpl.cpp: (DOM::HTMLImageElementImpl::parseMappedAttribute): Ditto.
  • khtml/html/html_objectimpl.cpp: (DOM::HTMLObjectElementImpl::parseMappedAttribute): Ditto.
  • khtml/html/html_headimpl.h:
  • khtml/html/html_headimpl.cpp: (HTMLScriptElementImpl::notifyFinished): Don't convert URL to QString since we now take a DOMString. (HTMLScriptElementImpl::evaluateScript): Change to take script as a DOMString.
  • khtml/khtml_part.h:
  • khtml/khtml_part.cpp: (KHTMLPart::createHTMLEventListener): Take a DOMString rather than a QString for the JavaScript code.
  • kwq/WebCoreScriptDebugger.mm: (-[WebCoreScriptCallFrame evaluateWebScript:]): Change code path so it doesn't convert an NSString to UTF-8 to get it into the JavaScript machinery. Use QString::fromNSString instead for now.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/interpreter.cpp

    r11527 r11614  
    110110}
    111111
    112 Completion Interpreter::evaluate(const UString &code, JSValue *thisV, const UString &)
    113 {
    114   return evaluate(UString(), 0, code, thisV);
    115 }
    116 
    117 Completion Interpreter::evaluate(const UString &sourceURL, int startingLineNumber, const UString &code, JSValue *thisV)
    118 {
    119   Completion comp = rep->evaluate(code,thisV, sourceURL, startingLineNumber);
    120 
    121 #if APPLE_CHANGES
    122   if (shouldPrintExceptions() && comp.complType() == Throw) {
    123     JSLock lock;
    124     ExecState *exec = rep->globalExec();
    125     char *f = strdup(sourceURL.ascii());
    126     const char *message = comp.value()->toObject(exec)->toString(exec).ascii();
    127     printf("[%d] %s:%s\n", getpid(), f, message);
    128 
    129     free(f);
    130   }
    131 #endif
    132 
    133   return comp;
     112Completion Interpreter::evaluate(const UString& sourceURL, int startingLineNumber, const UString& code, JSValue* thisV)
     113{
     114    return evaluate(sourceURL, startingLineNumber, code.data(), code.size());
     115}
     116
     117Completion Interpreter::evaluate(const UString& sourceURL, int startingLineNumber, const UChar* code, int codeLength, JSValue* thisV)
     118{
     119    Completion comp = rep->evaluate(code, codeLength, thisV, sourceURL, startingLineNumber);
     120
     121    if (shouldPrintExceptions() && comp.complType() == Throw) {
     122        JSLock lock;
     123        ExecState *exec = rep->globalExec();
     124        CString f = sourceURL.UTF8String();
     125        CString message = comp.value()->toObject(exec)->toString(exec).UTF8String();
     126        printf("[%d] %s:%s\n", getpid(), f.c_str(), message.c_str());
     127    }
     128
     129    return comp;
    134130}
    135131
Note: See TracChangeset for help on using the changeset viewer.