Ignore:
Timestamp:
Feb 11, 2013, 8:53:47 PM (13 years ago)
Author:
dmik
Message:

Merge icedtea-web v1.3 to trunk.

Location:
trunk/icedtea-web
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/icedtea-web

  • trunk/icedtea-web/plugin/icedteanp/IcedTeaJavaRequestProcessor.cc

    r358 r418  
    921921    {
    922922        className = "java.lang.String";
    923 #if MOZILLA_VERSION_COLLAPSED < 1090200
    924         stringArg += NPVARIANT_TO_STRING(variant).utf8characters;
    925 #else
    926         stringArg += NPVARIANT_TO_STRING(variant).UTF8Characters;
    927 #endif
     923        stringArg = IcedTeaPluginUtilities::NPVariantAsString(variant);
    928924    } else if (NPVARIANT_IS_OBJECT(variant))
    929925    {
     
    938934            PLUGIN_DEBUG("NPObject is not a Java object\n");
    939935            NPIdentifier length_id = browser_functions.getstringidentifier("length");
     936            bool isJSObjectArray = false;
    940937
    941938            // FIXME: We currently only handle <= 2 dim arrays. Do we really need more though?
     
    953950                IcedTeaPluginUtilities::itoa(NPVARIANT_TO_INT32(length), &length_str);
    954951
    955                 if (NPVARIANT_TO_INT32(length) > 0)
     952                if (NPVARIANT_TO_INT32(length) >= 0)
    956953                {
    957954                    NPIdentifier id_0 = browser_functions.getintidentifier(0);
     
    973970                        getArrayTypeForJava(instance, first_element, &java_array_type);
    974971                    }
    975                 } else
    976                     java_array_type.append("jsobject");
     972                }
     973
     974                // For JSObject arrays, we create a regular object (accessible via JSObject.getSlot())
     975                if (NPVARIANT_TO_INT32(length) < 0 || !java_array_type.compare("jsobject"))
     976                {
     977                    isJSObjectArray = true;
     978                    goto createRegularObject;
     979                }
    977980
    978981                java_result = java_request.newArray(java_array_type, length_str);
     
    10121015                // Got here => no errors above. We're good to return!
    10131016                return;
    1014             } else // Else it is not an array
     1017            }
     1018
     1019            createRegularObject:
     1020            if (!IcedTeaPluginUtilities::isObjectJSArray(instance, obj) || isJSObjectArray) // Else it is not an array
    10151021            {
    10161022
Note: See TracChangeset for help on using the changeset viewer.