[Webkit-unassigned] [Bug 20107] New: Array.push disappeared

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Jul 19 06:45:14 PDT 2008


https://bugs.webkit.org/show_bug.cgi?id=20107

           Summary: Array.push disappeared
           Product: WebKit
           Version: 526+ (Nightly build)
          Platform: PC
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: david.hansen at gmx.net


I'm sorry but i haven't managed to find a simpler (non GTK) test case.  Running
this little program results in the output:

** (jsarray:893): DEBUG: TypeError: Result of expression 'a.push' [undefined]
is not a function.

Note that the eval in the WebView widget does not produce any console messages.

#include <gtk/gtk.h>
#include <JavaScriptCore/JavaScript.h>
#include <webkit/webkit.h>

static gchar *
js_string_to_cstring (JSStringRef jsStr)
{
  gsize  len = JSStringGetMaximumUTF8CStringSize (jsStr);
  gchar *str = g_malloc (len);

  JSStringGetUTF8CString (jsStr, str, len);

  return str;
}

static gchar *
js_value_to_cstring (JSContextRef jsCtx, JSValueRef jsVal, JSValueRef *jsExn)
{
  JSStringRef  jsStr = JSValueToStringCopy (jsCtx, jsVal, jsExn);
  gchar       *str;

  if (NULL == jsStr)
    return NULL;

  str = js_string_to_cstring (jsStr);
  JSStringRelease (jsStr);

  return str;
}

int
main (int argc, char **argv)
{
  JSStringRef  jsStr;
  JSContextRef jsCtx        = JSGlobalContextCreate (NULL);
  JSValueRef   jsVal, jsExn = NULL;

  WebKitWebView *webview;

  gchar *str;

  gtk_init (&argc, &argv);

  webview  = WEBKIT_WEB_VIEW (webkit_web_view_new ());
  webkit_web_view_execute_script (webview, "a = []; a.push(42);");
  gtk_widget_destroy (GTK_WIDGET (webview));

  jsStr = JSStringCreateWithUTF8CString ("a = []; a.push(42);");
  jsVal = JSEvaluateScript (jsCtx, jsStr, NULL, NULL, 0, &jsExn);

  if (NULL == jsVal)
    jsVal = jsExn;

  str = js_value_to_cstring (jsCtx, jsVal, NULL);
  g_debug ("%s", str);

  return 0;
}

/*
  Local Variables:
  compile-command: "gcc -g -ggdb -O0 -W -Wall \
    `pkg-config --cflags --libs webkit-1.0`   \
    jsarray.c -o jsarray"
  End:
*/


-- 
Configure bugmail: https://bugs.webkit.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