1. 29 Jul, 2006 1 commit
    • darin's avatar
      JavaScriptCore: · ad19609e
      darin authored
              Reviewed by Darin.
      
              - fixes for Linux build
      
              * JavaScriptCoreSources.bkl: Added new files to build, kjs/PropertyNameArray.cpp
              and kjs/testkjs.cpp, and removed old files.
      
      WebCore:
      
              Reviewed and tweaked by Darin.
      
              - fixes for Linux build
                (still might not compile, since Darin tweaked but was unable to test).
      
              * WebCoreSources.bkl: Added some new sources, removed some obsolete ones.
              * Projects/gdk/webcore-gdk.bkl: Added RenderPopupMenuGdk.cpp
      
              * html/HTMLPlugInElement.h: Removed incorrect syntax with class name
              before ::.
      
              * platform/gdk/FrameGdk.h:
              * platform/gdk/FrameGdk.cpp: Updated parameters of constructor. Moved a couple stubs
              out of this file.
              * platform/gdk/RenderPopupMenuGdk.h: Added.
              * platform/gdk/RenderPopupMenuGdk.cpp: Added. Just a file full of empty stubs.
              * platform/gdk/RenderThemeGdk.h:
              * platform/gdk/RenderThemeGdk.cpp: (WebCore::RenderThemeGdk::createPopupMenu): Added.
      
              * platform/gdk/TemporaryLinkStubs.cpp: Add some new stubs.
      
      WebKitTools:
      
              Reviewed by Darin.
      
              - fixes for Linux build
      
              * GdkLauncher/mk: Added call to bakefile_gen before calling make.
              * GdkLauncher/gdklauncher.bkl: Tweak comment.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15691 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      ad19609e
  2. 24 Jul, 2006 4 commits
    • darin's avatar
      JavaScriptCore: · aacee81f
      darin authored
              Reviewed and tweaked a bit by Darin.
      
              - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=9902
                jsNull and NSNull not properly converted between JS and ObjC
      
              * bindings/objc/objc_utility.mm: (KJS::Bindings::convertObjcValueToValue):
              Added case for converting NSNull to jsNull.
      
      LayoutTests:
      
              Reviewed and tweaked a bit by Darin.
      
              - added some new tests that use "echo" including one for JavaScript null
      
              * plugins/bindings-test-expected.txt: Added results.
              * plugins/bindings-test.html: Added tests.
      
      WebCore:
      
              Reviewed and tweaked a bunch by Darin.
      
              Test: plugins/bindings-test.html
      
              - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=9902
                jsNull and NSNull not properly converted between JS and ObjC
      
              * bindings/objc/WebScriptObject.mm:
              (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:]):
              Added case that converts jsNull to NSNull.
      
      WebKitTools:
      
              Reviewed and tweaked a bit by Darin.
      
              * DumpRenderTree/ObjCPlugin.m:
              (+[ObjCPlugin isSelectorExcludedFromWebScript:]): Added "echo:".
              (+[ObjCPlugin webScriptNameForSelector:]): Use the name "echo" for
              "echo:" so it's nice to call from JavaScript.
              (-[ObjCPlugin echo:]): Just returns the same object -- can be used
              to test a round trip through Objective-C types.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15618 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      aacee81f
    • rwlbuis's avatar
      Reviewed by Darin. · d3a8de01
      rwlbuis authored
              http://bugzilla.opendarwin.org/show_bug.cgi?id=4258
              Date().toString() only includes GMT offset, not timezone string
      
              Use the info in tm_zone to append timezone abbreviation
              to Date().toString().
      
              * kjs/date_object.cpp:
              (KJS::formatTime):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15595 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      d3a8de01
    • rwlbuis's avatar
      Reviewed by Darin. · 81898cb4
      rwlbuis authored
              http://bugzilla.opendarwin.org/show_bug.cgi?id=5257
              setYear() does not match FireFox/IE behavior
      
              Make sure the right values end up in tm_year.
      
              * kjs/date_object.cpp:
              (KJS::formatTime):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15594 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      81898cb4
    • thatcher's avatar
      JavaScriptCore: · d5e16e37
      thatcher authored
              Reviewed by Maciej.
      
              Bug 9686: [Drosera] Need the ability to break into Drosera on Javascript exceptions
              http://bugzilla.opendarwin.org/show_bug.cgi?id=9686
      
              JavaScriptCore portion of the fix.
      
              * JavaScriptCore.exp: Update symbol for change in argument type.
              * kjs/debugger.cpp:
              (Debugger::detach): Clear map of recent exceptions.
              (Debugger::hasHandledException): Track the most recent exception
              thrown by an interpreter.
              (Debugger::exception): Change exception argument to a JSValue.
              * kjs/debugger.h:
              * kjs/nodes.cpp:
              (Node::debugExceptionIfNeeded): Notify the debugger of an exception
              if it hasn't seen it before.
              (ThrowNode::execute): Notify the debugger that an exception is being thrown.
              * kjs/nodes.h:
      
          2006-07-23  Geoffrey Garen  <ggaren@apple.com>
      
              Patch by Eric Albert, reviewed by Darin and me.
              
              - Fixed <rdar://problem/4645931> JavaScriptCore stack-scanning code 
              crashes (Collector::markStackObjectsConservatively)
              
              * bindings/jni/jni_jsobject.cpp: On 64bit systems, jint is a long, not an
              int.
              (JavaJSObject::getSlot):
              (JavaJSObject::setSlot):
              * kjs/collector.cpp:
              (KJS::Collector::markCurrentThreadConservatively): Use a pointer instead of
              an int as 'dummy,' because on LP64 systems, an int is not pointer-aligned,
              and we want to scan the stack for pointers.
              * JavaScriptCore.xcodeproj/project.pbxproj: After a tense cease-fire, the 
              XCode war has started up again!
      
      WebCore:
      
              Reviewed by maciej.
      
              Bug 9686: [Drosera] Need the ability to break into Drosera on Javascript exceptions
              http://bugzilla.opendarwin.org/show_bug.cgi?id=9686
      
              WebCore portion of the fix.
      
              * bridge/mac/WebCoreScriptDebugger.h:
              (-[WebScriptDebugger exceptionRaised:sourceId:line::]): Add delegate method.
              * bridge/mac/WebCoreScriptDebugger.mm:
              (WebCoreScriptDebuggerImp::exception): Call delegate method when an exception is raised.
      
      WebKit:
      
              Reviewed by Maciej.
      
              Bug 9686: [Drosera] Need the ability to break into Drosera on Javascript exceptions
              http://bugzilla.opendarwin.org/show_bug.cgi?id=9686
      
              WebKit portion of the fix.
      
              * DefaultDelegates/WebDefaultScriptDebugDelegate.m:
              (-[WebDefaultScriptDebugDelegate webView:exceptionWasRaised:sourceId:line:forWebFrame:]):
              * DefaultDelegates/WebScriptDebugServer.h:
              * DefaultDelegates/WebScriptDebugServer.m:
              (-[WebScriptDebugServer webView:exceptionWasRaised:sourceId:line:forWebFrame:]): Notify
              listeners that an exception has been raised.
              * WebView/WebScriptDebugDelegate.h:
              * WebView/WebScriptDebugDelegate.m:
              (-[WebScriptCallFrame exceptionRaised:sourceId:line:]): Dispatch through to delegate and
              WebScriptDebugServer.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15593 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      d5e16e37
  3. 23 Jul, 2006 1 commit
    • ggaren's avatar
      2006-07-23 Geoffrey Garen <ggaren@apple.com> · 2ee0f48a
      ggaren authored
              Patch by Eric Albert, reviewed by Darin and me.
              
              - Fixed <rdar://problem/4645931> JavaScriptCore stack-scanning code 
              crashes (Collector::markStackObjectsConservatively)
              
              * bindings/jni/jni_jsobject.cpp: On 64bit systems, jint is a long, not an
              int.
              (JavaJSObject::getSlot):
              (JavaJSObject::setSlot):
              * kjs/collector.cpp:
              (KJS::Collector::markCurrentThreadConservatively): Use a pointer instead of
              an int as 'dummy,' because on LP64 systems, an int is not pointer-aligned,
              and we want to scan the stack for pointers.
              * JavaScriptCore.xcodeproj/project.pbxproj: After a tense cease-fire, the 
              XCode war has started up again!
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15583 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      2ee0f48a
  4. 21 Jul, 2006 2 commits
    • thatcher's avatar
      Versioning · 5242dd66
      thatcher authored
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15561 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      5242dd66
    • ggaren's avatar
      JavaScriptCore: · b7d19066
      ggaren authored
              Reviewed by Darin.
      
              - Added support for strings that masquerade as undefined. Currently used
              by WebCore to implement undetectable style.filter.
              
              The name is a little long, but it's only used in one line of code, so I
              thought clarity should win over brevity.
      
              * JavaScriptCore.exp:
              * JavaScriptCore.xcodeproj/project.pbxproj:
              * kjs/object.h:
              * kjs/string_object.h:
              (KJS::StringInstanceThatMasqueradesAsUndefined::StringInstanceThatMasqueradesAsUndefined):
              (KJS::StringInstanceThatMasqueradesAsUndefined::masqueradeAsUndefined):
              (KJS::StringInstanceThatMasqueradesAsUndefined::toBoolean):
      
      LayoutTests:
      
              Test for undetectable style.filter property.
      
              * fast/dom/undetectable-style-filter-expected.txt: Added.
              * fast/dom/undetectable-style-filter.html: Added.
      
      WebCore:
      
              Reviewed by Darin.
              
              - Fixed <rdar://problem/4507265> REGRESSION: overlays don't work on 
              HousingMaps.com (Google Maps-based site)
              
              - Made style.filter undetectable, like document.all.
              
              Unfortunately, the SVG spec-makers invented a CSS attribute named 'filter',
              which conflicts with IE's custom CSS attribute by the same name. Web programs 
              like the Google maps API test for style.filter, and assume it's the IE 
              style.filter if they find it, so we need to make style.filter undetectable 
              to avoid breaking them.
              
              An alternative solution would be to hotwire a delorean, go back in time,
              and beg the web standards makers to make standards that work on the web.
      
              * bindings/js/kjs_css.cpp:
              (KJS::DOMCSSStyleDeclaration::cssPropertyGetter):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15557 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      b7d19066
  5. 20 Jul, 2006 1 commit
  6. 19 Jul, 2006 3 commits
    • andersca's avatar
      JavaScriptCore: · 30ea0f79
      andersca authored
      2006-07-19  Anders Carlsson  <acarlsson@apple.com>
      
              Reviewed by Darin.
      
              <rdar://problem/4620655> REGRESSION(10.4.7-10.5): preview button for a blogger.com post doesn't work
              
              * kjs/nodes2string.cpp:
              (StringNode::streamTo):
              Return the escaped string.
              
              (RegExpNode::streamTo):
              Use the correct syntax.
              
              * kjs/function.cpp:
              (KJS::escapeStringForPrettyPrinting):
              * kjs/function.h:
              Add escape function which escapes a string for pretty-printing so it can be parsed again.
              
              * wtf/unicode/icu/UnicodeIcu.h:
              (WTF::Unicode::isPrintableChar):
              New function.
      
      LayoutTests:
      
      2006-07-19  Anders Carlsson  <acarlsson@apple.com>
      
              Reviewed by Darin.
      
              <rdar://problem/4620655> REGRESSION(10.4.7-10.5): preview button for a blogger.com post doesn't work
              
              * fast/js/pretty-print-expected.txt: Added.
              * fast/js/pretty-print.html: Added.
              * fast/js/resources/pretty-print.js: Added.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15526 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      30ea0f79
    • thatcher's avatar
      Versioning · 12a453ab
      thatcher authored
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15524 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      12a453ab
    • mjs's avatar
      JavaScriptCore: · 279dd54f
      mjs authored
              Reviewed by Adele Peterson.
              
              <rdar://problem/4589530> REGRESSION: null character in JS string causes parse error (works in Tiger and in other browsers)
      
              * kjs/lexer.cpp:
              (Lexer::shift):
              (Lexer::lex):
              (Lexer::record16):
              (Lexer::scanRegExp):
              * kjs/lexer.h:
      
      LayoutTests:
      
              Reviewed by Adele Peterson.
              
              Test case for:
              
              <rdar://problem/4620646> REGRESSION(10.4.7-10.5): can't type into editing region when creating or editing a blogger.com post
      
              * fast/js/null-char-in-string-expected.txt: Added.
              * fast/js/null-char-in-string.html: Added.
              * fast/js/resources/null-char-in-string.js: Added.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15522 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      279dd54f
  7. 18 Jul, 2006 3 commits
  8. 17 Jul, 2006 7 commits
    • ggaren's avatar
      Reviewed by Maciej. · 0503a4b5
      ggaren authored
              
              - Added automatic prototype creation for classes.
              
              A class stores a weak reference to a prototype, which is cleared when
              the prototype is garbage collected, to avoid a reference cycle.
              
              We now have an attributes field in JSClassDefinition, that currently is
              used only to override automatic prototype creation when you want to manage your
              own prototypes, but can be extended in the future for other nefarious purposes.
              
              Similarly, we have JSObjectMake and JSObjectMakeWithPrototype, the latter
              allowing you to manage your own prototypes.
              
              JSObjectMakeConstructor is more interesting now, able to make a constructor
              on your behalf if you just give it a class.
              
              - Removed bogus old code from minidom.js.
              
              - Tweaked the headerdocs.
              
              - Added more GC testing, which caught some leaks, and tested more funny 
              edge cases in lookup, which caught a lookup bug. Removed some testing 
              we used to do with MyObject because it was redundant with the new, cool 
              stuff.
              
              While fixing the lookup bug I retracted this change:
              
                  "If a static setProperty callback returns 'false', to indicate that the
                  property was not set, we no longer forward the set request up the class
                  chain, because that's almost certainly not what the programmer expected."
      
              Returning false when setting a static property is a little silly, but you can see
              it being useful when shadowing a base class's static properties, and, regardless
              of usefullness, this is the defined behavior of the setProperty callback.
              
              - Plus a little ASCII art, for the kids.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15497 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      0503a4b5
    • thatcher's avatar
      JavaScriptCore: · 7aabf5de
      thatcher authored
              Reviewed by Maciej.
      
              <rdar://problem/4634874> WebScriptObject and WebUndefined are no longer defined by WebKit
      
              Moves WebScriptObject and WebUndefined up to WebCore.
              This change does create an upwards-dependancy on WebScriptObject existing
              in the loaded process, but this code path in JavaScriptCore does not get used
              unless it is through WebKit/WebCore. Moving all of the binding code out of
              JavaScriptCore might make sense in the future.
      
              * JavaScriptCore.exp:
              * JavaScriptCore.xcodeproj/project.pbxproj:
              * bindings/objc/WebScriptObject.h: Replaced.
              * bindings/objc/WebScriptObject.mm: Removed.
              * bindings/objc/WebScriptObjectPrivate.h: Removed.
              * bindings/objc/objc_class.h:
              * bindings/objc/objc_instance.h:
              * bindings/objc/objc_instance.mm:
              (ObjcInstance::~ObjcInstance):
              * bindings/objc/objc_runtime.h:
              * bindings/objc/objc_runtime.mm:
              (convertValueToObjcObject):
              * bindings/objc/objc_utility.mm:
              (KJS::Bindings::convertValueToObjcValue):
              (KJS::Bindings::convertObjcValueToValue):
              (KJS::Bindings::createObjcInstanceForValue):
      
      WebCore:
      
              Reviewed by Maciej.
      
              <rdar://problem/4634874> WebScriptObject and WebUndefined are no longer defined by WebKit
      
              Moves WebScriptObject and WebUndefined to WebCore.
      
              * WebCore.exp:
              * WebCore.xcodeproj/project.pbxproj:
              * bindings/objc/DOM.mm:
              * bindings/objc/DOMCore.h:
              * bindings/objc/DOMInternal.mm:
              * bindings/objc/DOMUtility.mm:
              * bindings/objc/WebScriptObject.mm: Added.
              (+[WebUndefined allocWithZone:]):
              (-[WebUndefined initWithCoder:]):
              (-[WebUndefined encodeWithCoder:]):
              (-[WebUndefined copyWithZone:]):
              * bindings/objc/WebScriptObjectPrivate.h: Added.
              * bridge/mac/FrameMac.mm:
              * bridge/mac/WebCoreScriptDebugger.mm:
      
      WebKit:
      
              Reviewed by Maciej.
      
              <rdar://problem/4634874> WebScriptObject and WebUndefined are no longer defined by WebKit
      
              Copy WebScriptObject.h from WebCore's private headers, not JavaScriptCore.
      
              * WebKit.xcodeproj/project.pbxproj:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15492 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      7aabf5de
    • darin's avatar
      * API/JSBase.h: Fix comment formatting where things used to be lined up but · 91eab014
      darin authored
              are now ragged. Got rid of spaces that attempted to line things up.
              * API/JSObjectRef.h: Ditto. Also add missing periods for a couple of comments.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15486 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      91eab014
    • ggaren's avatar
      Reviewed by Maciej. · 39f19043
      ggaren authored
              
              - Removed the exception parameter from the initialize callback and, by extension,
              JSObjectMake. We have never had a need for exceptions when iniitializing,
              so the parameter seemed likely to "get in the way." 
              
              Also, an exception in JavaScript is thrown in response to input -- 
              "invalid URL", "index not a number", etc., so it's the job of the 
              constructor function, not the initialize method, to throw.
              
              If initialize *really* wants to throw, it can communicate the throw to
              the constructor through the constructed object's private data (e.g., set
              it to NULL, signaling to the consntructor that initialization failed.)
              
              - Added JSObjectMakeWithData, which enables a constructor to set private
              data on an object *before* it has been initialized. That way, the initialize
              methods can properly operate on the data. 
      
              * API/JSNode.c: Moved ref into the initialize method, for better encapsulation,
              now that it's possible.
              * API/JSNodeList.c: ditto
              * API/minidom.c:
              (main): Do more aggressive garbage collection to test ref/deref and 
              initialize/finalize.
              * API/minidom.js: store childNodes in a temporary so it doesn't get re-created
              like a thousand times. This makes debugging ref/deref easier
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15484 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      39f19043
    • ggaren's avatar
      Reviewed by Maciej. · a121a87e
      ggaren authored
              
              - Changed the initialize callback to run from least derived class (parent
              class) to most derived class. This enables C++ style initialization,
              and derived class overriding of member data.
              
              - Added excpetion propopgation to JSObjectMake, to support initialize
              exceptions, and generally round out our policy of making function
              signatures as long as possible.
      
              * API/JSCallbackObject.h: Use ExecState instead of ContextRef, cuz we're
              in C++ land now.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15483 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      a121a87e
    • ggaren's avatar
      Reviewed by Maciej. · 55ae6eb7
      ggaren authored
              
              - Changed JSObjectMakeConstructor to JSObjectMakeConstructorWithCallback,
              to match JSObjectMakeFunctionWithCallback.
              
              - Added prototype parameter, so the generated constructor
              automatically works with hasInstance / instanceof
              
              - Moved hasInstance implementation from InternalFunctionImp to JSObject
              so that subclasses can inherit it without inheriting function-related baggage.
              More refactoring here would be good, but this seems like a good short-term
              solution.
      
              (KJS::JSCallbackFunction::implementsHasInstance): override and return false,
              because callback functions aren't constructors.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15482 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      55ae6eb7
    • mjs's avatar
      Reviewed by Geoff. · 127f8592
      mjs authored
              
              - add a JSContextRef parameter to all JSValueRef, JSObjectRef, and JSContextRef operations;
              except JSObject{Get,Set}PrivateData which can be assumed to be simple pure accessors.
              
              Also renamed the parameter "context" to "ctx" because it makes the code read better with this pervasive
              but usually uninteresting parameter.
      
              * API/JSBase.cpp:
              (JSEvaluateScript):
              (JSCheckScriptSyntax):
              (JSGarbageCollect):
              * API/JSBase.h:
              * API/JSCallbackObject.cpp:
              (KJS::JSCallbackObject::JSCallbackObject):
              (KJS::JSCallbackObject::init):
              (KJS::JSCallbackObject::getOwnPropertySlot):
              (KJS::JSCallbackObject::put):
              (KJS::JSCallbackObject::deleteProperty):
              (KJS::JSCallbackObject::toNumber):
              (KJS::JSCallbackObject::toString):
              * API/JSContextRef.cpp:
              (JSGlobalContextCreate):
              (JSGlobalContextRetain):
              (JSGlobalContextRelease):
              (JSContextGetGlobalObject):
              * API/JSContextRef.h:
              * API/JSNode.c:
              (JSNodePrototype_appendChild):
              (JSNodePrototype_removeChild):
              (JSNodePrototype_replaceChild):
              (JSNode_getNodeType):
              (JSNode_getFirstChild):
              (JSNode_prototype):
              * API/JSNodeList.c:
              (JSNodeListPrototype_item):
              (JSNodeList_length):
              (JSNodeList_getProperty):
              (JSNodeList_prototype):
              * API/JSObjectRef.cpp:
              (JSObjectMake):
              (JSObjectMakeFunctionWithCallback):
              (JSObjectMakeConstructor):
              (JSObjectMakeFunction):
              (JSObjectGetPrototype):
              (JSObjectSetPrototype):
              (JSObjectHasProperty):
              (JSObjectGetProperty):
              (JSObjectSetProperty):
              (JSObjectGetPropertyAtIndex):
              (JSObjectSetPropertyAtIndex):
              (JSObjectDeleteProperty):
              (JSObjectIsFunction):
              (JSObjectCallAsFunction):
              (JSObjectIsConstructor):
              (JSObjectCallAsConstructor):
              (JSObjectCopyPropertyNames):
              * API/JSObjectRef.h:
              * API/JSStringRef.cpp:
              * API/JSValueRef.cpp:
              (JSValueGetType):
              (JSValueIsUndefined):
              (JSValueIsNull):
              (JSValueIsBoolean):
              (JSValueIsNumber):
              (JSValueIsString):
              (JSValueIsObject):
              (JSValueIsObjectOfClass):
              (JSValueIsEqual):
              (JSValueIsStrictEqual):
              (JSValueIsInstanceOfConstructor):
              (JSValueMakeUndefined):
              (JSValueMakeNull):
              (JSValueMakeBoolean):
              (JSValueMakeNumber):
              (JSValueMakeString):
              (JSValueToBoolean):
              (JSValueToNumber):
              (JSValueToStringCopy):
              (JSValueToObject):
              (JSValueProtect):
              (JSValueUnprotect):
              * API/JSValueRef.h:
              * API/minidom.c:
              (print):
              * API/testapi.c:
              (MyObject_getProperty):
              (MyObject_deleteProperty):
              (MyObject_callAsFunction):
              (MyObject_callAsConstructor):
              (MyObject_convertToType):
              (print_callAsFunction):
              (main):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      127f8592
  9. 16 Jul, 2006 6 commits
    • ggaren's avatar
      Approved by Maciej, RS by Beth. · dd0d0e1f
      ggaren authored
              
              JSObjectMakeFunction -> JSObjectMakeFunctionWithCallback
              JSObjectMakeFunctionWithBody -> JSObjectMakeFunction
              
              because the latter is more common, and more fundamental, than the former.
      
              * API/APICast.h:
              (toJS):
              * API/JSBase.h:
              * API/JSCallbackObject.cpp:
              (KJS::JSCallbackObject::getOwnPropertySlot):
              (KJS::JSCallbackObject::put):
              (KJS::JSCallbackObject::deleteProperty):
              (KJS::JSCallbackObject::getPropertyNames):
              (KJS::JSCallbackObject::staticValueGetter):
              (KJS::JSCallbackObject::staticFunctionGetter):
              * API/JSClassRef.cpp:
              (OpaqueJSClass::OpaqueJSClass):
              (OpaqueJSClass::~OpaqueJSClass):
              * API/JSClassRef.h:
              * API/JSObjectRef.cpp:
              (JSClassCreate):
              (JSObjectMakeFunctionWithCallback):
              (JSObjectMakeFunction):
              (OpaqueJSPropertyNameArray::OpaqueJSPropertyNameArray):
              (JSObjectCopyPropertyNames):
              * API/JSObjectRef.h:
              * API/minidom.c:
              (main):
              * API/testapi.c:
              (main):
              * ChangeLog:
              * JavaScriptCore.exp:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15480 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      dd0d0e1f
    • darin's avatar
      - try to fix Windows build · 554611a1
      darin authored
              * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
              Added some recently added files, removed some recently removed.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15476 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      554611a1
    • ggaren's avatar
      Reviewed by Maciej. · 747b08b8
      ggaren authored
              
              - Change getProperty* to return undefined, rather than NULL, for missing
              properties, since that's what the spec says. Also added exception out
              parameters to the *Index functions, because they can call through to the
              regular functions, which can throw for custom objects.
      
              * API/JSObjectRef.cpp:
              (JSObjectGetProperty):
              (JSObjectGetPropertyAtIndex):
              (JSObjectSetPropertyAtIndex):
              * API/JSObjectRef.h:
              * API/testapi.c:
              (main):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15474 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      747b08b8
    • ggaren's avatar
      Reviewed by Maciej. · 532d614d
      ggaren authored
              
              - Properly document and handle NULL callbacks for static properties. We
              throw an exception in any case other than a ReadOnly property with a NULL
              setProperty callback, because a NULL callback almost certainly indicates 
              a programming error. Also throw an exception if hasProperty returns true
              for a property that getProperty can't get.
              
              - If a static setProperty callback returns 'false', to indicate that the
              property was not set, we no longer forward the set request up the class
              chain, because that's almost certainly not what the programmer expected.
      
              * API/JSCallbackObject.cpp:
              (KJS::JSCallbackObject::getOwnPropertySlot):
              (KJS::JSCallbackObject::put):
              (KJS::JSCallbackObject::staticValueGetter):
              (KJS::JSCallbackObject::staticFunctionGetter):
              (KJS::JSCallbackObject::callbackGetter):
              * API/JSObjectRef.h:
              * API/minidom.js:
              * API/testapi.c:
              (MyObject_hasProperty):
              * API/testapi.js:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15473 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      532d614d
    • ggaren's avatar
      Reviewed by Maciej. · a2d061c7
      ggaren authored
              
              - Added names to functions.
              
              - Removed GetPrivate/SetPrivate from callbackFunctions and callbackConstructors.
              The private data idiom is that a JS object stores its native implementation
              as private data. For functions and constructors, the native implementation is nothing
              more than the callback they already store, so supporting private data, too,
              confuses the idiom. If you *really* want, you can still create a custom 
              function with private data.
      
              * API/JSCallbackConstructor.cpp:
              * API/JSCallbackConstructor.h:
              * API/JSCallbackFunction.cpp:
              (KJS::JSCallbackFunction::JSCallbackFunction):
              * API/JSCallbackFunction.h:
              * API/JSCallbackObject.cpp:
              (KJS::JSCallbackObject::staticFunctionGetter):
              * API/JSObjectRef.cpp:
              (JSObjectMakeFunction):
              (JSObjectMakeFunctionWithBody):
              (JSObjectGetPrivate):
              (JSObjectSetPrivate):
              * API/JSObjectRef.h:
              * API/minidom.c:
              (main):
              * API/testapi.c:
              (main):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15469 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      a2d061c7
    • mjs's avatar
      JavaScriptCore: · b3598b86
      mjs authored
              Reviewed by Darin.
              
              - switch property lists to be vector+set of Identifiers instead of list of References
              
              This has the following benefits:
              
              - no duplicates in property lists
              - simplifies API calls
              - probably more efficient, since linked list is gone
              - entirely removed Reference, ReferenceList and ProtectedReference types from the API
      
              * kjs/PropertyNameArray.cpp: Added.
              (KJS::PropertyNameArray::add): Check set, if not already there, add to
              vector.
              * kjs/PropertyNameArray.h: Added.
              (KJS::PropertyNameArray::PropertyNameArray): Newly added type, combines
              a set and a vector to make a unique but ordered list of identifiers.
              (KJS::PropertyNameArray::begin): ditto
              (KJS::PropertyNameArray::end): ditto
              (KJS::PropertyNameArray::size): ditto
              (KJS::PropertyNameArray::operator[]): ditto
              * kjs/array_instance.h:
              * kjs/array_object.cpp:
              (ArrayInstance::getPropertyNames): renamed from getPropertyList, updated
              for PropertyNameArray
              (ArrayInstance::setLength): updated for PropertyNameArray
              (ArrayInstance::pushUndefinedObjectsToEnd): ditto
              * kjs/nodes.cpp:
              (ForInNode::execute): updated for PropertyNameArray
              * kjs/nodes.h:
              * kjs/object.cpp:
              (KJS::JSObject::getPropertyNames): renamed from getPropertyList, updated
              for PropertyNameArray
              * kjs/object.h:
              * kjs/property_map.cpp:
              (KJS::PropertyMap::getEnumerablePropertyNames): updated for PropertyNameArray
              (KJS::PropertyMap::getSparseArrayPropertyNames): ditto
              * kjs/property_map.h:
              * kjs/protected_reference.h: Removed.
              * kjs/reference.cpp: Removed.
              * kjs/reference.h: Removed.
              * kjs/reference_list.cpp: Removed.
              * kjs/reference_list.h: Removed.
              * kjs/scope_chain.cpp:
              (KJS::ScopeChain::print): Use PropertyNamesArray instead of ReferenceList.
              * kjs/string_object.cpp:
              (StringInstance::getPropertyNames): Updated for new approach.
              * kjs/string_object.h:
              * kjs/ustring.h:
              * API/APICast.h:
              (toJS): Added overload for PropertyNameAccumulatorRef / PropertyNameArray*
              (toRef): ditto
              * API/JSBase.h:
              * API/JSCallbackObject.cpp:
              (KJS::JSCallbackObject::getPropertyNames): Fixed for new API.
              * API/JSCallbackObject.h:
              * API/JSObjectRef.cpp:
              (__JSPropertyNameArray::__JSPropertyNameArray): Type used for a publicly vended
              JSPropertyNameArrayRef.
              (JSObjectCopyPropertyNames): New API call - renamed / refactored from 
              JSObjectCreatePropertyList
              (JSPropertyNameArrayRetain): new retain call for JSPropertyNameArray.
              (JSPropertyNameArrayRelease): new release call for - " -.
              (JSPropertyNameArrayGetCount): Instead of having to use a stateful enumerator you
              can now get the count and items in any order.
              (JSPropertyNameArrayGetNameAtIndex): See above.
              (JSPropertyNameAccumulatorAddName): What you add properties to is now an opaque 
              accumulator object.
              * API/JSObjectRef.h: Prototyped new functions, removed old ones
              * JavaScriptCore.exp: Updated exported symbols.
              * JavaScriptCore.xcodeproj/project.pbxproj: Added new files, removed old.
              * API/testapi.c:
              (MyObject_getPropertyNames): Renamed / fixed callback to fit new paradigm.
              (main): Updated for new API.
      
      JavaScriptGlue:
      
              Reviewed by Darin.
      
              - switch property lists to be vector+set of Identifiers instead of list of References
              
              * JSUtils.cpp:
              (KJSValueToCFTypeInternal): updated for JSC SPI changes
              * JSValueWrapper.cpp:
              (JSValueWrapper::JSObjectCopyPropertyNames): ditto
              * UserObjectImp.cpp:
              (UserObjectImp::getPropertyNames): ditto
              * UserObjectImp.h:
      
      LayoutTests:
      
              Reviewed by Darin.
              
              - new test case and updated results for property list changes
      
              * fast/js/for-in-avoid-duplicates-expected.txt: Added.
              * fast/js/for-in-avoid-duplicates.html: Added.
              * fast/js/kde/Array-expected.txt:
              * fast/js/resources/for-in-avoid-duplicates.js: Added.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15468 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      b3598b86
  10. 15 Jul, 2006 6 commits
    • darin's avatar
      - oops, missed a few more arrays that had to be const · f53a4ecc
      darin authored
              * API/JSNode.c:
              (JSNodePrototype_appendChild): Added const.
              (JSNodePrototype_removeChild): Ditto.
              (JSNodePrototype_replaceChild): Ditto.
              (JSNode_construct): Ditto.
              * API/JSNodeList.c:
              (JSNodeListPrototype_item): Ditto.
              * API/JSObjectRef.cpp:
              (JSObjectMakeFunctionWithBody): Ditto.
              (JSObjectCallAsFunction): Ditto.
              (JSObjectCallAsConstructor): Ditto.
              * API/minidom.c:
              (print): Ditto.
              * API/testapi.c:
              (MyObject_callAsFunction): Ditto.
              (MyObject_callAsConstructor): Ditto.
              (print_callAsFunction): Ditto.
              (myConstructor_callAsConstructor): Ditto.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15465 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      f53a4ecc
    • darin's avatar
      Reviewed by Maciej. · 60d097d6
      darin authored
              * API/JSNode.h: Made an array parameter const.
              * API/JSObjectRef.h: Made array parameters const. Fixed a comment.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15464 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      60d097d6
    • ggaren's avatar
      Reviewed by Maciej. · eafa7e75
      ggaren authored
              
              - JSObjectMakeFunctionWithBody includes a function name and named parameters now.
      
              * API/JSObjectRef.cpp:
              (JSObjectMakeFunctionWithBody):
              * API/JSObjectRef.h:
              * API/testapi.c:
              (assertEqualsAsUTF8String): More informative failure reporting.
              (main): Test more function cases.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15463 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      eafa7e75
    • ggaren's avatar
      Reviewed by Maciej. · 855855b4
      ggaren authored
              - Moved the arguments passed to JSClassCreate into a single structure,
              called JSClassDefinition. This will enable easier structure 
              migration/versioning in the future, if necessary.
              
              - Added support for class names.
              
              - kJSClassDefinitionNull replaces kJSObjectCallbacksNone.
              
              - JSClass is becoming a fairly complex struct, so I migrated all of its
              implementation other than reference counting to the sruct.
              
              - Also moved JSClass* functions in the API to JSObjectRef.cpp, since they're
              declared in JSObjectRef.h
              
              - Also added some more informative explanation to the class structure doc.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15462 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      855855b4
    • darin's avatar
      JavaScriptCore: · 496882ee
      darin authored
              Reviewed by Geoff.
      
              - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8395
                <rdar://problem/4613467>
                REGRESSION: RegEx seems broken for hex escaped non breaking space
      
              Test: fast/js/regexp-extended-characters-more.html
      
              * pcre/pcre_exec.c:
              (match): Got rid of utf16Length local variable to guarantee there's no
              extra stack usage in recursive calls. Fixed two places in the PCRE_UTF16
              code that were using the length variable, which is the UTF-8 length of
              a character in the pattern, to move in the UTF-16 subject string. Instead
              they hardcode lengths of 1 and 2 since the code already handles BMP
              characters and surrogate pairs separately. Also fixed some DPRINTF so
              I could compile with DEBUG on.
              (pcre_exec): Changed a place that was checking for multibyte characters
              in the subject string to use ISMIDCHAR. Instead it was using hardcoded
              logic that was right for UTF-8 but wrong for UTF-16.
      
              * pcre/pcre_compile.c: (pcre_compile2): Fixed a DPRINTF so I could compile
              with DEBUG on.
      
      LayoutTests:
      
              Reviewed by Geoff.
      
              - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=8395
                <rdar://problem/4613467>
                REGRESSION: RegEx seems broken for hex escaped non breaking space
      
              * fast/js/regexp-extended-characters-more-expected.txt: Added.
              * fast/js/regexp-extended-characters-more.html: Added.
              * fast/js/resources/regexp-extended-characters-more.js: Added.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15455 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      496882ee
    • thatcher's avatar
      Build fix for case-sensitive file systems. · 48172010
      thatcher authored
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15445 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      48172010
  11. 14 Jul, 2006 6 commits
    • ggaren's avatar
      RS by Maciej. · e806fb8e
      ggaren authored
              
              Global replace in the API of argc/argv with argumentCount/arguments.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15444 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      e806fb8e
    • ggaren's avatar
      Reviewed by Maciej. · 292e70e1
      ggaren authored
              
              - Finalized exception handling in the API.
              
              setProperty can throw because it throws for built-in arrays. getProperty
              and deleteProperty can throw because setProperty can throw and we want
              to be consistent, and also because they seem like "actions." callAsFunction,
              callAsConstructor, and hasInstance can throw, because they caan throw for
              all built-ins.
              
              toBoolean can't throw because it's defined that way in the spec.
              
              - Documented that toBoolean and toObject can't be overridden by custom 
              objects because they're defined that way in the spec.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15443 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      292e70e1
    • thatcher's avatar
      Versioning · bc6ef0a9
      thatcher authored
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15440 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      bc6ef0a9
    • ggaren's avatar
      JavaScriptCore: · 41694b65
      ggaren authored
              Reviewed by Maciej.
              
              - Implemented ref-counting of JSContexts by splitting into two datatypes:
              JSGlobalContext, which you can create/retain/release, and JSContext, which
              you can't.
              
              Internally, you retain a JSGlobalContext/ExecState by retaining its
              interpreter, which, in the case of a global ExecState, owns it.
              
              - Also made ~Interpreter() protected to catch places where Interpreter
              is manually deleted. (Can't make it private because some crazy fool
              decided it would be a good idea to subclass Interpreter in other frameworks.
              I pity da fool.)
      
              * API/APICast.h: 
              (toJS): Added cast for new JSGlobalContext
              * API/JSStringRef.h: Changed vague "you must" language to more specific
              (but, ultimately, equally vague) "behavior is undefined if you don't" 
              language.
              (KJS::Interpreter::Interpreter): Factored more common initialization into
              init()
              * kjs/interpreter.h:
              (KJS::Interpreter::ref): new
              (KJS::Interpreter::deref): new
              (KJS::Interpreter::refCount): new
              * kjs/testkjs.cpp: 
              (doIt): Ref-count the interpreter.
      
      JavaScriptGlue:
      
              Reviewed by Maciej.
              
              - Updated JSInterpreter to work with Interpreter ref-counting in JavaScriptCore.
      
              (JSInterpreter::JSInterpreter::~JSInterpreter): Now protected to catch
              manual delete.
      
      WebCore:
      
              Reviewed by Maciej.
      
              - Updated ScriptInterpreter to work with Interpreter ref-counting in 
              JavaScriptCore.
      
              (KJS::ScriptInterpreter::~ScriptInterpreter): Now protected to catch
              manual delete.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15437 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      41694b65
    • mjs's avatar
      Reviewed by Geoff. · 57c2ec19
      mjs authored
              
              - removed bool return value from JSObjectSetProperty, since it is inefficient and
              also doesn't work quite right
              - added JSObjectGetPropertyAtIndex and JSObjectSetPropertyAtIndex
      
              * API/JSObjectRef.cpp:
              (JSObjectSetProperty): Removed return value and canPut stuff.
              (JSObjectGetPropertyAtIndex): Added.
              (JSObjectSetPropertyAtIndex): Added.
              * API/JSObjectRef.h: Prototyped and documented new functions.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15434 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      57c2ec19
    • ggaren's avatar
      Reviewed by Beth. · 6105a724
      ggaren authored
              
              Moved JSCheckScriptSyntax, JSEvaluateScript, and JSGarbageCollect into
              JSBase.h/.cpp. They don't belong in the value-specific or context-specific 
              files because they're not part of the value or context implementations.
      
              * API/JSBase.h:
              * API/JSContextRef.cpp:
              (JSContextGetGlobalObject):
              * API/JSContextRef.h:
              * API/JSValueRef.cpp:
              (JSValueUnprotect):
              * API/JSValueRef.h:
              * JavaScriptCore.xcodeproj/project.pbxproj:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15428 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      6105a724