[Webkit-unassigned] [Bug 9902] New: jsNull and NSNull not properly converted between JS and ObjC

bugzilla-daemon at opendarwin.org bugzilla-daemon at opendarwin.org
Thu Jul 13 18:10:37 PDT 2006


http://bugzilla.opendarwin.org/show_bug.cgi?id=9902

           Summary: jsNull and NSNull not properly converted between JS and
                    ObjC
           Product: WebKit
           Version: 420+ (nightly)
          Platform: Macintosh
        OS/Version: Mac OS X 10.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at opendarwin.org
        ReportedBy: waylonis at mac.com
                CC: abob at google.com


Hi, I'm working for Google on a WebKit plugin.

I've found that JS code with a "null" value will be converted to [WebUndefined
undefined] when sent to a WebKit plug-in, and that there is no way to return a
JS "null" from the plug-in (returning nil results in a JS "undefined" value).

The documentation
(http://developer.apple.com/documentation/Cocoa/Conceptual/DisplayWebContent/Tasks/JavaScriptFromObjC.html)
states that NSNull will be converted to/from JS's null.

A very straightforward fix for this would be to add these lines:

objc_utility.mm:convertObjcValueToValue:(line 236)
                } else if ([*obj isKindOfClass:[NSNull class]]) {
                  aValue = jsNull();

WebScriptObject.mm:_convertValueToObjcValue:(line 436)
    else if (value->isNull())
        // JS Null -> NSNull
        return [NSNull null];

I came across this bug when I found that
invokeUndefinedMethodFromWebScript:withArgs: was not being called for JS code
that had a null in the arguments.  What happens is that inside of
ObjcInstance::invokeMethod() the null is turned into a actual NULL (0x0) value,
and when the code tries to add it to the objcArgs array, it throws an exception
and the invocation never happens.

The above code changes fix the discrepancy between the documentation and
reality as well as fixes the bug that I just mentioned.

Thanks,
Dan


-- 
Configure bugmail: http://bugzilla.opendarwin.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list