Example #1
0
JSTrapStatus
xpc_DebuggerKeywordHandler(JSContext *cx, JSScript *script, jsbytecode *pc,
                           jsval *rval, void *closure)
{
    static const char line[] =
    "------------------------------------------------------------------------";
    puts(line);
    puts("Hit JavaScript \"debugger\" keyword. JS call stack...");
    xpc_DumpJSStack(cx, JS_TRUE, JS_TRUE, JS_FALSE);
    puts(line);
    return JSTRAP_CONTINUE;
}
Example #2
0
JSTrapStatus
xpc_DebuggerKeywordHandler(JSContext *cx, JSScript *script, jsbytecode *pc,
                           jsval *rval, void *closure)
{
    static const char line[] =
    "------------------------------------------------------------------------\n";
    DebugDump("%s", line);
    DebugDump("%s", "Hit JavaScript \"debugger\" keyword. JS call stack...\n");
    xpc_DumpJSStack(cx, true, true, false);
    DebugDump("%s", line);
    return JSTRAP_CONTINUE;
}
Example #3
0
void
LogSlimWrapperNotCreated(JSContext *cx, nsISupports *obj, const char *reason)
{
    char* className = nsnull;
    nsCOMPtr<nsIClassInfo> ci = do_QueryInterface(obj);
    if (ci)
        ci->GetClassDescription(&className);
    printf("***** refusing to create slim wrapper%s%s, reason: %s (%p)\n",
           className ? " for " : "", className ? className : "", reason, obj);
    if (className)
        PR_Free(className);
    JSAutoRequest autoRequest(cx);
    xpc_DumpJSStack(cx, false, false, false);
}
Example #4
0
void
LogSlimWrapperWillMorph(JSContext *cx, JSObject *obj, const char *propname,
                        const char *functionName)
{
    if (obj && IS_SLIM_WRAPPER(obj)) {
        XPCNativeScriptableInfo *si =
            GetSlimWrapperProto(obj)->GetScriptableInfo();
        printf("***** morphing %s from %s", si->GetJSClass()->name,
               functionName);
        if (propname)
            printf(" for %s", propname);
        printf(" (%p, %p)\n", obj,
               static_cast<nsISupports*>(xpc_GetJSPrivate(obj)));
        xpc_DumpJSStack(cx, false, false, false);
    }
}
void DEBUG_CheckForComponentsInScope(JSContext* cx, JSObject* obj,
                                     JSObject* startingObj,
                                     JSBool OKIfNotInitialized,
                                     XPCJSRuntime* runtime)
{
    if(OKIfNotInitialized)
        return;

    if(!(JS_GetOptions(cx) & JSOPTION_PRIVATE_IS_NSISUPPORTS))
        return;

    const char* name = runtime->GetStringName(XPCJSRuntime::IDX_COMPONENTS);
    jsval prop;
    if(JS_LookupProperty(cx, obj, name, &prop) && !JSVAL_IS_PRIMITIVE(prop))
        return;

    // This is pretty much always bad. It usually means that native code is
    // making a callback to an interface implemented in JavaScript, but the
    // document where the JS object was created has already been cleared and the
    // global properties of that document's window are *gone*. Generally this
    // indicates a problem that should be addressed in the design and use of the
    // callback code.
    NS_ERROR("XPConnect is being called on a scope without a 'Components' property!  (stack and details follow)");
    printf("The current JS stack is:\n");
    xpc_DumpJSStack(cx, JS_TRUE, JS_TRUE, JS_TRUE);

    printf("And the object whose scope lacks a 'Components' property is:\n");
    js_DumpObject(startingObj);

    JSObject *p = startingObj;
    while(p->isWrapper())
    {
        p = p->getProxyPrivate().toObjectOrNull();
        if(!p)
            break;
        printf("which is a wrapper for:\n");
        js_DumpObject(p);
    }
}