js/xpconnect/src/XPCWrappedJSClass.cpp
author Ryan VanderMeulen <ryanvm@gmail.com>
Thu, 18 Jul 2013 14:47:54 -0400
changeset 138889 af4e3ce8c487a8e0477451bf1748cfed51f9ab4c
parent 137301 0c45375d507ee8699f6a25760263234f7c9e8823
child 139585 e324bd4c78f7d495c05404c7895b1eef94215c39
permissions -rw-r--r--
Merge m-c to birch.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
     1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
59512
b9aa4b7efd929518b8f84afae30052c128f7fe7d Bug 606498 - Make sure the new nsIScriptError2 is used in all possible places- part 1; r=bzbarsky,dbaron,mrbkap sr=jst a=blocking2.0
Mihai Sucan <mihai.sucan@gmail.com>
parents: 58977
diff changeset
     2
 * vim: set ts=8 sw=4 et tw=78:
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
     3
 *
94475
Gervase Markham <gerv@gerv.net>
parents: 93854
diff changeset
     4
 * This Source Code Form is subject to the terms of the Mozilla Public
Gervase Markham <gerv@gerv.net>
parents: 93854
diff changeset
     5
 * License, v. 2.0. If a copy of the MPL was not distributed with this
Gervase Markham <gerv@gerv.net>
parents: 93854
diff changeset
     6
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
     7
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
     8
/* Sharable code and data for wrapper around JSObjects. */
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
     9
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    10
#include "xpcprivate.h"
27611
3e3a7373a3d06e3bb94d726250f9df6d6955ffdf Bug 488265 Use an XPCOM array enumerator instead of rolling our own r+sr=mrbkap
Neil Rashbrook <neil@parkwaycc.co.uk>
parents: 27428
diff changeset
    11
#include "nsArrayEnumerator.h"
27646
d50609a6b63e0c5977f9c034bbebfe03015607eb Bug 489440 - Don't call into JS when asked if we support a wrapper cache. r+sr=peterv
Blake Kaplan <mrbkap@gmail.com>
parents: 27611
diff changeset
    12
#include "nsWrapperCache.h"
27664
da473f63b7edd2b552032f0843d0e9ad043b5b64 Bug 475864 - Move native anonymous content checks into a wrapper so that quickstubs don't sidestep them. r=jst sr=bzbarsky
Blake Kaplan <mrbkap@gmail.com>
parents: 27646
diff changeset
    13
#include "XPCWrapper.h"
55604
c42a624a877c66721a8a4b827bae87be66740b0d bug 580128 - Avoid using the parent chain of proxies for anything because it's often wrong. r=jst
Blake Kaplan <mrbkap@gmail.com>
parents: 55601
diff changeset
    14
#include "AccessCheck.h"
59512
b9aa4b7efd929518b8f84afae30052c128f7fe7d Bug 606498 - Make sure the new nsIScriptError2 is used in all possible places- part 1; r=bzbarsky,dbaron,mrbkap sr=jst a=blocking2.0
Mihai Sucan <mihai.sucan@gmail.com>
parents: 58977
diff changeset
    15
#include "nsJSUtils.h"
96584
3dd7e4d5c8f24b023ff11fad3eff24fc2fba83c7 Bug 758992 - Make the classes which use the XPCOM nsISupports implementation macros final, to avoid the warning about deleting using a pointer to a base class with virtual functions and no virtual dtor (xpconnect parts); r=bholley
Ehsan Akhgari <ehsan@mozilla.com>
parents: 96333
diff changeset
    16
#include "mozilla/Attributes.h"
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    17
84476
4b70a75df702f70bede9cf47005a4ed2039c5391 Bug 677079 - Part x: Move AutoValueVector to jsapi.h; r=evilpie
Ms2ger <ms2ger@gmail.com>
parents: 84461
diff changeset
    18
#include "jsapi.h"
137301
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
    19
#include "jsfriendapi.h"
84166
6324ddbe266839db9a2395a13064857e20f44940 Bug 714458 - Part c: Don't include jscntxt.h in xpcprivate.h; r=bholley
Ms2ger <ms2ger@gmail.com>
parents: 84165
diff changeset
    20
111396
f060ac1febfb878360274ca36f3a0cc17db63d5c Bug 797821 - Replace usage of XPCWrappedNativeScope::FindInJSObjectScope(ccx, obj) with GetObjectScope(obj). r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 108810
diff changeset
    21
using namespace xpc;
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
    22
using namespace JS;
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
    23
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    24
NS_IMPL_THREADSAFE_ISUPPORTS1(nsXPCWrappedJSClass, nsIXPCWrappedJSClass)
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    25
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    26
// the value of this variable is never used - we use its address as a sentinel
83645
69fe2af4da71132bc31b8866e1bb9e96a1f97a21 Bug 714057 - Remove uintn users from XPConnect; r=bholley+khuey
Ms2ger <ms2ger@gmail.com>
parents: 83298
diff changeset
    27
static uint32_t zero_methods_descriptor;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    28
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
    29
bool AutoScriptEvaluate::StartEvaluating(HandleObject scope, JSErrorReporter errorReporter)
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    30
{
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    31
    NS_PRECONDITION(!mEvaluated, "AutoScriptEvaluate::Evaluate should only be called once");
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    32
61765
96570116d62a16fb7a04ba6fb6d694137f0dda1a Enter compartment in AutoScriptEvaluate (bug 630243, r=jst, a=blocker).
Andreas Gal <gal@mozilla.com>
parents: 61451
diff changeset
    33
    if (!mJSContext)
78840
ec7577dec4fceef0ac2717416d9c48289402d935 Bug 690892 - Replace PR_TRUE/PR_FALSE with true/false on mozilla-central; rs=dbaron
Ehsan Akhgari <ehsan@mozilla.com>
parents: 78745
diff changeset
    34
        return true;
61765
96570116d62a16fb7a04ba6fb6d694137f0dda1a Enter compartment in AutoScriptEvaluate (bug 630243, r=jst, a=blocker).
Andreas Gal <gal@mozilla.com>
parents: 61451
diff changeset
    35
78840
ec7577dec4fceef0ac2717416d9c48289402d935 Bug 690892 - Replace PR_TRUE/PR_FALSE with true/false on mozilla-central; rs=dbaron
Ehsan Akhgari <ehsan@mozilla.com>
parents: 78745
diff changeset
    36
    mEvaluated = true;
84461
f9fe45249420b8b0b0d216cc57e40498f866b726 Bug 677079 - Part i: Expose errorReporter in jsapi.h; r=mrbkap
Ms2ger <ms2ger@gmail.com>
parents: 84175
diff changeset
    37
    if (!JS_GetErrorReporter(mJSContext)) {
20343
3aec0eec68a13bc51e3261c1edd1daf92f15df5c Bug 455436 - "XPConnect insists on using its own error reporter even when another is already set." r+sr=jst.
Ben Turner <bent.mozilla@gmail.com>
parents: 19673
diff changeset
    38
        JS_SetErrorReporter(mJSContext, errorReporter);
78840
ec7577dec4fceef0ac2717416d9c48289402d935 Bug 690892 - Replace PR_TRUE/PR_FALSE with true/false on mozilla-central; rs=dbaron
Ehsan Akhgari <ehsan@mozilla.com>
parents: 78745
diff changeset
    39
        mErrorReporterSet = true;
20343
3aec0eec68a13bc51e3261c1edd1daf92f15df5c Bug 455436 - "XPConnect insists on using its own error reporter even when another is already set." r+sr=jst.
Ben Turner <bent.mozilla@gmail.com>
parents: 19673
diff changeset
    40
    }
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    41
85316
e517d4c431436772c46802f98618155ea8e37973 Bug 675078 - rm JSThreadData and JSThread (JSRuntime is now officially single-threaded) (r=igor,rs=mccr8)
Luke Wagner <luke@mozilla.com>
parents: 85309
diff changeset
    42
    JS_BeginRequest(mJSContext);
103263
0d61ae018d9f97407a37e327ee526fb018619f62 Bug 625199 - s/JSAutoEnterCompartment/JSAutoCompartment/ and make it infallible (r=bholley)
Luke Wagner <luke@mozilla.com>
parents: 102997
diff changeset
    43
    mAutoCompartment.construct(mJSContext, scope);
61765
96570116d62a16fb7a04ba6fb6d694137f0dda1a Enter compartment in AutoScriptEvaluate (bug 630243, r=jst, a=blocker).
Andreas Gal <gal@mozilla.com>
parents: 61451
diff changeset
    44
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    45
    // Saving the exception state keeps us from interfering with another script
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    46
    // that may also be running on this context.  This occurred first with the
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    47
    // js debugger, as described in
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    48
    // http://bugzilla.mozilla.org/show_bug.cgi?id=88130 but presumably could
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    49
    // show up in any situation where a script calls into a wrapped js component
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    50
    // on the same context, while the context has a nonzero exception state.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    51
    // Because JS_SaveExceptionState/JS_RestoreExceptionState use malloc
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    52
    // and addroot, we avoid them if possible by returning null (as opposed to
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    53
    // a JSExceptionState with no information) when there is no pending
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    54
    // exception.
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
    55
    if (JS_IsExceptionPending(mJSContext)) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    56
        mState = JS_SaveExceptionState(mJSContext);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    57
        JS_ClearPendingException(mJSContext);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    58
    }
61765
96570116d62a16fb7a04ba6fb6d694137f0dda1a Enter compartment in AutoScriptEvaluate (bug 630243, r=jst, a=blocker).
Andreas Gal <gal@mozilla.com>
parents: 61451
diff changeset
    59
78840
ec7577dec4fceef0ac2717416d9c48289402d935 Bug 690892 - Replace PR_TRUE/PR_FALSE with true/false on mozilla-central; rs=dbaron
Ehsan Akhgari <ehsan@mozilla.com>
parents: 78745
diff changeset
    60
    return true;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    61
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    62
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    63
AutoScriptEvaluate::~AutoScriptEvaluate()
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    64
{
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
    65
    if (!mJSContext || !mEvaluated)
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    66
        return;
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
    67
    if (mState)
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    68
        JS_RestoreExceptionState(mJSContext, mState);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    69
    else
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    70
        JS_ClearPendingException(mJSContext);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    71
85316
e517d4c431436772c46802f98618155ea8e37973 Bug 675078 - rm JSThreadData and JSThread (JSRuntime is now officially single-threaded) (r=igor,rs=mccr8)
Luke Wagner <luke@mozilla.com>
parents: 85309
diff changeset
    72
    JS_EndRequest(mJSContext);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    73
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    74
    // If this is a JSContext that has a private context that provides a
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    75
    // nsIXPCScriptNotify interface, then notify the object the script has
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    76
    // been executed.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    77
    //
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    78
    // Note: We rely on the rule that if any JSContext in our JSRuntime has
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    79
    // private data that points to an nsISupports subclass, it has also set
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    80
    // the JSOPTION_PRIVATE_IS_NSISUPPORTS option.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    81
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
    82
    if (JS_GetOptions(mJSContext) & JSOPTION_PRIVATE_IS_NSISUPPORTS) {
78739
014c9cf5088f1af09d9d3969771c9ef857b3dd78 Bug 688012 - Remove trailing whitespace within XPConnect. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78738
diff changeset
    83
        nsCOMPtr<nsIXPCScriptNotify> scriptNotify =
3233
ab58bdbde9e03330d3a406d8b95aa3877152cf36 Bug 348748 - Replace all instances of NS_STATIC_CAST and friends with C++ casts (and simultaneously bitrot nearly every patch in existence). r=bsmedberg on the script that did this. Tune in next time for Macro Wars: Episode II: Attack on the LL_* Macros.
jwalden@mit.edu
parents: 2456
diff changeset
    84
            do_QueryInterface(static_cast<nsISupports*>
78745
fd0a23a7f093dbf9b9c0dbf30df5fa2257492e0f Bug 688012 - Manual fixup of multi-line c++ cast alignment. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78744
diff changeset
    85
                                         (JS_GetContextPrivate(mJSContext)));
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
    86
        if (scriptNotify)
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    87
            scriptNotify->ScriptExecuted();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    88
    }
20343
3aec0eec68a13bc51e3261c1edd1daf92f15df5c Bug 455436 - "XPConnect insists on using its own error reporter even when another is already set." r+sr=jst.
Ben Turner <bent.mozilla@gmail.com>
parents: 19673
diff changeset
    89
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
    90
    if (mErrorReporterSet)
20343
3aec0eec68a13bc51e3261c1edd1daf92f15df5c Bug 455436 - "XPConnect insists on using its own error reporter even when another is already set." r+sr=jst.
Ben Turner <bent.mozilla@gmail.com>
parents: 19673
diff changeset
    91
        JS_SetErrorReporter(mJSContext, NULL);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    92
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    93
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    94
// It turns out that some errors may be not worth reporting. So, this
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    95
// function is factored out to manage that.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    96
JSBool xpc_IsReportableErrorCode(nsresult code)
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
    97
{
14170
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
    98
    if (NS_SUCCEEDED(code))
80807
3258ba3a269d5e865b720c853120e088d4537e10 Bug 701467 - Remove JS_TRUE/JS_FALSE from xpconnect; r=bholley
Ms2ger <ms2ger@gmail.com>
parents: 80787
diff changeset
    99
        return false;
14170
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
   100
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   101
    switch (code) {
14170
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
   102
        // Error codes that we don't want to report as errors...
78739
014c9cf5088f1af09d9d3969771c9ef857b3dd78 Bug 688012 - Remove trailing whitespace within XPConnect. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78738
diff changeset
   103
        // These generally indicate bad interface design AFAIC.
14170
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
   104
        case NS_ERROR_FACTORY_REGISTER_AGAIN:
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
   105
        case NS_BASE_STREAM_WOULD_BLOCK:
80807
3258ba3a269d5e865b720c853120e088d4537e10 Bug 701467 - Remove JS_TRUE/JS_FALSE from xpconnect; r=bholley
Ms2ger <ms2ger@gmail.com>
parents: 80787
diff changeset
   106
            return false;
100861
a6842357e0bc53567a41160ea02648443fb2fc98 Bug 777292 - Add default cases to switches on nsresult; r=ehsan
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   107
        default:
a6842357e0bc53567a41160ea02648443fb2fc98 Bug 777292 - Add default cases to switches on nsresult; r=ehsan
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   108
            return true;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   109
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   110
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   111
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   112
// static
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   113
nsresult
107626
343dde4d974df3f3d46ff22b5bfec24fe60b7983 Bug 785096 - part2: Removing XPCCallContext dependency from XPCVariant; r=bholley
Gabor Krizsanits <gkrizsanits@mozilla.com>
parents: 106784
diff changeset
   114
nsXPCWrappedJSClass::GetNewOrUsed(JSContext* cx, REFNSIID aIID,
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   115
                                  nsXPCWrappedJSClass** resultClazz)
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   116
{
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   117
    nsXPCWrappedJSClass* clazz = nullptr;
107626
343dde4d974df3f3d46ff22b5bfec24fe60b7983 Bug 785096 - part2: Removing XPCCallContext dependency from XPCVariant; r=bholley
Gabor Krizsanits <gkrizsanits@mozilla.com>
parents: 106784
diff changeset
   118
    XPCJSRuntime* rt = nsXPConnect::GetRuntimeInstance();
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   119
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   120
    {   // scoped lock
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   121
        XPCAutoLock lock(rt->GetMapLock());
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   122
        IID2WrappedJSClassMap* map = rt->GetWrappedJSClassMap();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   123
        clazz = map->Find(aIID);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   124
        NS_IF_ADDREF(clazz);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   125
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   126
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   127
    if (!clazz) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   128
        nsCOMPtr<nsIInterfaceInfo> info;
133709
eea9248f39a92afe4890c4c4962ef5b7fe1b6df8 bug 873622 - speed up nsXPConnect::GetXPConnect() and rename it since it never returns null r=bholley
Trevor Saunders <trev.saunders@gmail.com>
parents: 133564
diff changeset
   129
        nsXPConnect::XPConnect()->GetInfoForIID(&aIID, getter_AddRefs(info));
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   130
        if (info) {
77799
e7854b4d29ba905ae3994f821b160c989bac4260 Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
Michael Wu <mwu@mozilla.com>
parents: 77538
diff changeset
   131
            bool canScript, isBuiltin;
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   132
            if (NS_SUCCEEDED(info->IsScriptable(&canScript)) && canScript &&
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   133
                NS_SUCCEEDED(info->IsBuiltinClass(&isBuiltin)) && !isBuiltin &&
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   134
                nsXPConnect::IsISupportsDescendant(info)) {
107626
343dde4d974df3f3d46ff22b5bfec24fe60b7983 Bug 785096 - part2: Removing XPCCallContext dependency from XPCVariant; r=bholley
Gabor Krizsanits <gkrizsanits@mozilla.com>
parents: 106784
diff changeset
   135
                clazz = new nsXPCWrappedJSClass(cx, aIID, info);
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   136
                if (clazz && !clazz->mDescriptors)
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   137
                    NS_RELEASE(clazz);  // sets clazz to nullptr
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   138
            }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   139
        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   140
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   141
    *resultClazz = clazz;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   142
    return NS_OK;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   143
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   144
107626
343dde4d974df3f3d46ff22b5bfec24fe60b7983 Bug 785096 - part2: Removing XPCCallContext dependency from XPCVariant; r=bholley
Gabor Krizsanits <gkrizsanits@mozilla.com>
parents: 106784
diff changeset
   145
nsXPCWrappedJSClass::nsXPCWrappedJSClass(JSContext* cx, REFNSIID aIID,
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   146
                                         nsIInterfaceInfo* aInfo)
107626
343dde4d974df3f3d46ff22b5bfec24fe60b7983 Bug 785096 - part2: Removing XPCCallContext dependency from XPCVariant; r=bholley
Gabor Krizsanits <gkrizsanits@mozilla.com>
parents: 106784
diff changeset
   147
    : mRuntime(nsXPConnect::GetRuntimeInstance()),
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   148
      mInfo(aInfo),
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   149
      mName(nullptr),
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   150
      mIID(aIID),
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   151
      mDescriptors(nullptr)
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   152
{
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   153
    NS_ADDREF(mInfo);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   154
    NS_ADDREF_THIS();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   155
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   156
    {   // scoped lock
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   157
        XPCAutoLock lock(mRuntime->GetMapLock());
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   158
        mRuntime->GetWrappedJSClassMap()->Add(this);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   159
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   160
83645
69fe2af4da71132bc31b8866e1bb9e96a1f97a21 Bug 714057 - Remove uintn users from XPConnect; r=bholley+khuey
Ms2ger <ms2ger@gmail.com>
parents: 83298
diff changeset
   161
    uint16_t methodCount;
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   162
    if (NS_SUCCEEDED(mInfo->GetMethodCount(&methodCount))) {
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   163
        if (methodCount) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   164
            int wordCount = (methodCount/32)+1;
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   165
            if (nullptr != (mDescriptors = new uint32_t[wordCount])) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   166
                int i;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   167
                // init flags to 0;
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   168
                for (i = wordCount-1; i >= 0; i--)
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   169
                    mDescriptors[i] = 0;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   170
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   171
                for (i = 0; i < methodCount; i++) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   172
                    const nsXPTMethodInfo* info;
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   173
                    if (NS_SUCCEEDED(mInfo->GetMethodInfo(i, &info)))
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   174
                        SetReflectable(i, XPCConvert::IsMethodReflectable(*info));
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   175
                    else {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   176
                        delete [] mDescriptors;
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   177
                        mDescriptors = nullptr;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   178
                        break;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   179
                    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   180
                }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   181
            }
78744
25a5c9891392c72ac42f2771176d3f0d803ae890 Bug 688012 - Hoist 'else' clauses to the line of the previous close-curly-brace. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78743
diff changeset
   182
        } else {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   183
            mDescriptors = &zero_methods_descriptor;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   184
        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   185
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   186
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   187
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   188
nsXPCWrappedJSClass::~nsXPCWrappedJSClass()
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   189
{
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   190
    if (mDescriptors && mDescriptors != &zero_methods_descriptor)
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   191
        delete [] mDescriptors;
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   192
    if (mRuntime)
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   193
    {   // scoped lock
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   194
        XPCAutoLock lock(mRuntime->GetMapLock());
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   195
        mRuntime->GetWrappedJSClassMap()->Remove(this);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   196
    }
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   197
    if (mName)
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   198
        nsMemory::Free(mName);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   199
    NS_IF_RELEASE(mInfo);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   200
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   201
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   202
JSObject*
107626
343dde4d974df3f3d46ff22b5bfec24fe60b7983 Bug 785096 - part2: Removing XPCCallContext dependency from XPCVariant; r=bholley
Gabor Krizsanits <gkrizsanits@mozilla.com>
parents: 106784
diff changeset
   203
nsXPCWrappedJSClass::CallQueryInterfaceOnJSObject(JSContext* cx,
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   204
                                                  JSObject* jsobjArg,
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   205
                                                  REFNSIID aIID)
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   206
{
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   207
    RootedObject jsobj(cx, jsobjArg);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   208
    JSObject* id;
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   209
    RootedValue retval(cx);
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   210
    RootedObject retObj(cx);
80807
3258ba3a269d5e865b720c853120e088d4537e10 Bug 701467 - Remove JS_TRUE/JS_FALSE from xpconnect; r=bholley
Ms2ger <ms2ger@gmail.com>
parents: 80787
diff changeset
   211
    JSBool success = false;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   212
    jsid funid;
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   213
    RootedValue fun(cx);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   214
30623
94fc37d58985072dba5f68b2d28f738102a8323c Bug 503926 - Don't call QueryInterface on content JS objects. r=bzbarsky sr=jst
Blake Kaplan <mrbkap@gmail.com>
parents: 29947
diff changeset
   215
    // Don't call the actual function on a content object. We'll determine
94fc37d58985072dba5f68b2d28f738102a8323c Bug 503926 - Don't call QueryInterface on content JS objects. r=bzbarsky sr=jst
Blake Kaplan <mrbkap@gmail.com>
parents: 29947
diff changeset
   216
    // whether or not a content object is capable of implementing the
94fc37d58985072dba5f68b2d28f738102a8323c Bug 503926 - Don't call QueryInterface on content JS objects. r=bzbarsky sr=jst
Blake Kaplan <mrbkap@gmail.com>
parents: 29947
diff changeset
   217
    // interface (i.e. whether the interface is scriptable) and most content
94fc37d58985072dba5f68b2d28f738102a8323c Bug 503926 - Don't call QueryInterface on content JS objects. r=bzbarsky sr=jst
Blake Kaplan <mrbkap@gmail.com>
parents: 29947
diff changeset
   218
    // objects don't have QI implementations anyway. Also see bug 503926.
97274
0581a34dde2a2d61f8098d56abcae5c78f6864ae Bug 755255 - Remove Usage of XPCPerThreadData::IsMainThread. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 97272
diff changeset
   219
    if (!xpc::AccessCheck::isChrome(js::GetObjectCompartment(jsobj))) {
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   220
        return nullptr;
30623
94fc37d58985072dba5f68b2d28f738102a8323c Bug 503926 - Don't call QueryInterface on content JS objects. r=bzbarsky sr=jst
Blake Kaplan <mrbkap@gmail.com>
parents: 29947
diff changeset
   221
    }
94fc37d58985072dba5f68b2d28f738102a8323c Bug 503926 - Don't call QueryInterface on content JS objects. r=bzbarsky sr=jst
Blake Kaplan <mrbkap@gmail.com>
parents: 29947
diff changeset
   222
61765
96570116d62a16fb7a04ba6fb6d694137f0dda1a Enter compartment in AutoScriptEvaluate (bug 630243, r=jst, a=blocker).
Andreas Gal <gal@mozilla.com>
parents: 61451
diff changeset
   223
    // OK, it looks like we'll be calling into JS code.
96570116d62a16fb7a04ba6fb6d694137f0dda1a Enter compartment in AutoScriptEvaluate (bug 630243, r=jst, a=blocker).
Andreas Gal <gal@mozilla.com>
parents: 61451
diff changeset
   224
    AutoScriptEvaluate scriptEval(cx);
96570116d62a16fb7a04ba6fb6d694137f0dda1a Enter compartment in AutoScriptEvaluate (bug 630243, r=jst, a=blocker).
Andreas Gal <gal@mozilla.com>
parents: 61451
diff changeset
   225
96570116d62a16fb7a04ba6fb6d694137f0dda1a Enter compartment in AutoScriptEvaluate (bug 630243, r=jst, a=blocker).
Andreas Gal <gal@mozilla.com>
parents: 61451
diff changeset
   226
    // XXX we should install an error reporter that will send reports to
96570116d62a16fb7a04ba6fb6d694137f0dda1a Enter compartment in AutoScriptEvaluate (bug 630243, r=jst, a=blocker).
Andreas Gal <gal@mozilla.com>
parents: 61451
diff changeset
   227
    // the JS error console service.
96570116d62a16fb7a04ba6fb6d694137f0dda1a Enter compartment in AutoScriptEvaluate (bug 630243, r=jst, a=blocker).
Andreas Gal <gal@mozilla.com>
parents: 61451
diff changeset
   228
    if (!scriptEval.StartEvaluating(jsobj))
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   229
        return nullptr;
61765
96570116d62a16fb7a04ba6fb6d694137f0dda1a Enter compartment in AutoScriptEvaluate (bug 630243, r=jst, a=blocker).
Andreas Gal <gal@mozilla.com>
parents: 61451
diff changeset
   230
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   231
    // check upfront for the existence of the function property
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   232
    funid = mRuntime->GetStringID(XPCJSRuntime::IDX_QUERY_INTERFACE);
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   233
    if (!JS_GetPropertyById(cx, jsobj, funid, fun.address()) || JSVAL_IS_PRIMITIVE(fun))
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   234
        return nullptr;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   235
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   236
    // Ensure that we are asking for a scriptable interface.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   237
    // NB:  It's important for security that this check is here rather
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   238
    // than later, since it prevents untrusted objects from implementing
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   239
    // some interfaces in JS and aggregating a trusted object to
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   240
    // implement intentionally (for security) unscriptable interfaces.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   241
    // We so often ask for nsISupports that we can short-circuit the test...
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   242
    if (!aIID.Equals(NS_GET_IID(nsISupports))) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   243
        nsCOMPtr<nsIInterfaceInfo> info;
133709
eea9248f39a92afe4890c4c4962ef5b7fe1b6df8 bug 873622 - speed up nsXPConnect::GetXPConnect() and rename it since it never returns null r=bholley
Trevor Saunders <trev.saunders@gmail.com>
parents: 133564
diff changeset
   244
        nsXPConnect::XPConnect()->GetInfoForIID(&aIID, getter_AddRefs(info));
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   245
        if (!info)
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   246
            return nullptr;
77799
e7854b4d29ba905ae3994f821b160c989bac4260 Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
Michael Wu <mwu@mozilla.com>
parents: 77538
diff changeset
   247
        bool canScript, isBuiltin;
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   248
        if (NS_FAILED(info->IsScriptable(&canScript)) || !canScript ||
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   249
            NS_FAILED(info->IsBuiltinClass(&isBuiltin)) || isBuiltin)
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   250
            return nullptr;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   251
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   252
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   253
    id = xpc_NewIDObject(cx, jsobj, aIID);
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   254
    if (id) {
21852
13ebc220fad375ca6df4a9bb9f2739b1174bace5 Bug 459790 - "Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] )". r+sr=jst, a=mconnor.
Ben Turner <bent.mozilla@gmail.com>
parents: 21377
diff changeset
   255
        // Throwing NS_NOINTERFACE is the prescribed way to fail QI from JS. It
13ebc220fad375ca6df4a9bb9f2739b1174bace5 Bug 459790 - "Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] )". r+sr=jst, a=mconnor.
Ben Turner <bent.mozilla@gmail.com>
parents: 21377
diff changeset
   256
        // is not an exception that is ever worth reporting, but we don't want
13ebc220fad375ca6df4a9bb9f2739b1174bace5 Bug 459790 - "Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] )". r+sr=jst, a=mconnor.
Ben Turner <bent.mozilla@gmail.com>
parents: 21377
diff changeset
   257
        // to eat all exceptions either.
13ebc220fad375ca6df4a9bb9f2739b1174bace5 Bug 459790 - "Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] )". r+sr=jst, a=mconnor.
Ben Turner <bent.mozilla@gmail.com>
parents: 21377
diff changeset
   258
83645
69fe2af4da71132bc31b8866e1bb9e96a1f97a21 Bug 714057 - Remove uintn users from XPConnect; r=bholley+khuey
Ms2ger <ms2ger@gmail.com>
parents: 83298
diff changeset
   259
        uint32_t oldOpts =
21852
13ebc220fad375ca6df4a9bb9f2739b1174bace5 Bug 459790 - "Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] )". r+sr=jst, a=mconnor.
Ben Turner <bent.mozilla@gmail.com>
parents: 21377
diff changeset
   260
          JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_DONT_REPORT_UNCAUGHT);
13ebc220fad375ca6df4a9bb9f2739b1174bace5 Bug 459790 - "Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] )". r+sr=jst, a=mconnor.
Ben Turner <bent.mozilla@gmail.com>
parents: 21377
diff changeset
   261
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   262
        jsval args[1] = {OBJECT_TO_JSVAL(id)};
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   263
        success = JS_CallFunctionValue(cx, jsobj, fun, 1, args, retval.address());
21852
13ebc220fad375ca6df4a9bb9f2739b1174bace5 Bug 459790 - "Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] )". r+sr=jst, a=mconnor.
Ben Turner <bent.mozilla@gmail.com>
parents: 21377
diff changeset
   264
22041
d50fb8c0d589999bbc8560223457cb37723cf9e0 Bug 459790 - 'Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] ).' Followup fix for JS impls. r+sr=jst, a=blocking1.9.1+
Ben Turner <bent.mozilla@gmail.com>
parents: 21852
diff changeset
   265
        JS_SetOptions(cx, oldOpts);
d50fb8c0d589999bbc8560223457cb37723cf9e0 Bug 459790 - 'Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] ).' Followup fix for JS impls. r+sr=jst, a=blocking1.9.1+
Ben Turner <bent.mozilla@gmail.com>
parents: 21852
diff changeset
   266
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   267
        if (!success) {
21852
13ebc220fad375ca6df4a9bb9f2739b1174bace5 Bug 459790 - "Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] )". r+sr=jst, a=mconnor.
Ben Turner <bent.mozilla@gmail.com>
parents: 21377
diff changeset
   268
            NS_ASSERTION(JS_IsExceptionPending(cx),
13ebc220fad375ca6df4a9bb9f2739b1174bace5 Bug 459790 - "Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] )". r+sr=jst, a=mconnor.
Ben Turner <bent.mozilla@gmail.com>
parents: 21377
diff changeset
   269
                         "JS failed without setting an exception!");
13ebc220fad375ca6df4a9bb9f2739b1174bace5 Bug 459790 - "Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] )". r+sr=jst, a=mconnor.
Ben Turner <bent.mozilla@gmail.com>
parents: 21377
diff changeset
   270
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   271
            RootedValue jsexception(cx, NullValue());
21852
13ebc220fad375ca6df4a9bb9f2739b1174bace5 Bug 459790 - "Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] )". r+sr=jst, a=mconnor.
Ben Turner <bent.mozilla@gmail.com>
parents: 21377
diff changeset
   272
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   273
            if (JS_GetPendingException(cx, jsexception.address())) {
22041
d50fb8c0d589999bbc8560223457cb37723cf9e0 Bug 459790 - 'Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] ).' Followup fix for JS impls. r+sr=jst, a=blocking1.9.1+
Ben Turner <bent.mozilla@gmail.com>
parents: 21852
diff changeset
   274
                nsresult rv;
93854
366ab61b0af74eba87742c3495c32bda388f5cb6 Bug 752226 - Remove any use of JSVAL_IS_OBJECT. r=luke,Ms2ger
Tom Schuster <evilpies@gmail.com>
parents: 93813
diff changeset
   275
                if (jsexception.isObject()) {
22041
d50fb8c0d589999bbc8560223457cb37723cf9e0 Bug 459790 - 'Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] ).' Followup fix for JS impls. r+sr=jst, a=blocking1.9.1+
Ben Turner <bent.mozilla@gmail.com>
parents: 21852
diff changeset
   276
                    // XPConnect may have constructed an object to represent a
d50fb8c0d589999bbc8560223457cb37723cf9e0 Bug 459790 - 'Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] ).' Followup fix for JS impls. r+sr=jst, a=blocking1.9.1+
Ben Turner <bent.mozilla@gmail.com>
parents: 21852
diff changeset
   277
                    // C++ QI failure. See if that is the case.
d50fb8c0d589999bbc8560223457cb37723cf9e0 Bug 459790 - 'Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] ).' Followup fix for JS impls. r+sr=jst, a=blocking1.9.1+
Ben Turner <bent.mozilla@gmail.com>
parents: 21852
diff changeset
   278
                    nsCOMPtr<nsIXPConnectWrappedNative> wrapper;
21852
13ebc220fad375ca6df4a9bb9f2739b1174bace5 Bug 459790 - "Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] )". r+sr=jst, a=mconnor.
Ben Turner <bent.mozilla@gmail.com>
parents: 21377
diff changeset
   279
133709
eea9248f39a92afe4890c4c4962ef5b7fe1b6df8 bug 873622 - speed up nsXPConnect::GetXPConnect() and rename it since it never returns null r=bholley
Trevor Saunders <trev.saunders@gmail.com>
parents: 133564
diff changeset
   280
                    nsXPConnect::XPConnect()->
107626
343dde4d974df3f3d46ff22b5bfec24fe60b7983 Bug 785096 - part2: Removing XPCCallContext dependency from XPCVariant; r=bholley
Gabor Krizsanits <gkrizsanits@mozilla.com>
parents: 106784
diff changeset
   281
                        GetWrappedNativeOfJSObject(cx,
93854
366ab61b0af74eba87742c3495c32bda388f5cb6 Bug 752226 - Remove any use of JSVAL_IS_OBJECT. r=luke,Ms2ger
Tom Schuster <evilpies@gmail.com>
parents: 93813
diff changeset
   282
                                                   &jsexception.toObject(),
22041
d50fb8c0d589999bbc8560223457cb37723cf9e0 Bug 459790 - 'Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] ).' Followup fix for JS impls. r+sr=jst, a=blocking1.9.1+
Ben Turner <bent.mozilla@gmail.com>
parents: 21852
diff changeset
   283
                                                   getter_AddRefs(wrapper));
21852
13ebc220fad375ca6df4a9bb9f2739b1174bace5 Bug 459790 - "Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] )". r+sr=jst, a=mconnor.
Ben Turner <bent.mozilla@gmail.com>
parents: 21377
diff changeset
   284
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   285
                    if (wrapper) {
22041
d50fb8c0d589999bbc8560223457cb37723cf9e0 Bug 459790 - 'Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] ).' Followup fix for JS impls. r+sr=jst, a=blocking1.9.1+
Ben Turner <bent.mozilla@gmail.com>
parents: 21852
diff changeset
   286
                        nsCOMPtr<nsIException> exception =
d50fb8c0d589999bbc8560223457cb37723cf9e0 Bug 459790 - 'Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] ).' Followup fix for JS impls. r+sr=jst, a=blocking1.9.1+
Ben Turner <bent.mozilla@gmail.com>
parents: 21852
diff changeset
   287
                            do_QueryWrappedNative(wrapper);
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   288
                        if (exception &&
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   289
                            NS_SUCCEEDED(exception->GetResult(&rv)) &&
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   290
                            rv == NS_NOINTERFACE) {
22041
d50fb8c0d589999bbc8560223457cb37723cf9e0 Bug 459790 - 'Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] ).' Followup fix for JS impls. r+sr=jst, a=blocking1.9.1+
Ben Turner <bent.mozilla@gmail.com>
parents: 21852
diff changeset
   291
                            JS_ClearPendingException(cx);
d50fb8c0d589999bbc8560223457cb37723cf9e0 Bug 459790 - 'Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] ).' Followup fix for JS impls. r+sr=jst, a=blocking1.9.1+
Ben Turner <bent.mozilla@gmail.com>
parents: 21852
diff changeset
   292
                        }
d50fb8c0d589999bbc8560223457cb37723cf9e0 Bug 459790 - 'Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] ).' Followup fix for JS impls. r+sr=jst, a=blocking1.9.1+
Ben Turner <bent.mozilla@gmail.com>
parents: 21852
diff changeset
   293
                    }
78744
25a5c9891392c72ac42f2771176d3f0d803ae890 Bug 688012 - Hoist 'else' clauses to the line of the previous close-curly-brace. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78743
diff changeset
   294
                } else if (JSVAL_IS_NUMBER(jsexception)) {
22041
d50fb8c0d589999bbc8560223457cb37723cf9e0 Bug 459790 - 'Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] ).' Followup fix for JS impls. r+sr=jst, a=blocking1.9.1+
Ben Turner <bent.mozilla@gmail.com>
parents: 21852
diff changeset
   295
                    // JS often throws an nsresult.
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   296
                    if (JSVAL_IS_DOUBLE(jsexception))
104460
844b142d811163f0c545aadbb021f2d85e4839a4 Bug 783523 - Fix platform-specific nsresult misuse; r=ehsan,tbsaunde,smaug
Aryeh Gregor <ayg@aryeh.name>
parents: 103263
diff changeset
   297
                        // Visual Studio 9 doesn't allow casting directly from
844b142d811163f0c545aadbb021f2d85e4839a4 Bug 783523 - Fix platform-specific nsresult misuse; r=ehsan,tbsaunde,smaug
Aryeh Gregor <ayg@aryeh.name>
parents: 103263
diff changeset
   298
                        // a double to an enumeration type, contrary to
844b142d811163f0c545aadbb021f2d85e4839a4 Bug 783523 - Fix platform-specific nsresult misuse; r=ehsan,tbsaunde,smaug
Aryeh Gregor <ayg@aryeh.name>
parents: 103263
diff changeset
   299
                        // 5.2.9(10) of C++11, so add an intermediate cast.
844b142d811163f0c545aadbb021f2d85e4839a4 Bug 783523 - Fix platform-specific nsresult misuse; r=ehsan,tbsaunde,smaug
Aryeh Gregor <ayg@aryeh.name>
parents: 103263
diff changeset
   300
                        rv = (nsresult)(uint32_t)(JSVAL_TO_DOUBLE(jsexception));
22041
d50fb8c0d589999bbc8560223457cb37723cf9e0 Bug 459790 - 'Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] ).' Followup fix for JS impls. r+sr=jst, a=blocking1.9.1+
Ben Turner <bent.mozilla@gmail.com>
parents: 21852
diff changeset
   301
                    else
d50fb8c0d589999bbc8560223457cb37723cf9e0 Bug 459790 - 'Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] ).' Followup fix for JS impls. r+sr=jst, a=blocking1.9.1+
Ben Turner <bent.mozilla@gmail.com>
parents: 21852
diff changeset
   302
                        rv = (nsresult)(JSVAL_TO_INT(jsexception));
d50fb8c0d589999bbc8560223457cb37723cf9e0 Bug 459790 - 'Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] ).' Followup fix for JS impls. r+sr=jst, a=blocking1.9.1+
Ben Turner <bent.mozilla@gmail.com>
parents: 21852
diff changeset
   303
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   304
                    if (rv == NS_NOINTERFACE)
21852
13ebc220fad375ca6df4a9bb9f2739b1174bace5 Bug 459790 - "Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] )". r+sr=jst, a=mconnor.
Ben Turner <bent.mozilla@gmail.com>
parents: 21377
diff changeset
   305
                        JS_ClearPendingException(cx);
13ebc220fad375ca6df4a9bb9f2739b1174bace5 Bug 459790 - "Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] )". r+sr=jst, a=mconnor.
Ben Turner <bent.mozilla@gmail.com>
parents: 21377
diff changeset
   306
                }
13ebc220fad375ca6df4a9bb9f2739b1174bace5 Bug 459790 - "Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] )". r+sr=jst, a=mconnor.
Ben Turner <bent.mozilla@gmail.com>
parents: 21377
diff changeset
   307
            }
13ebc220fad375ca6df4a9bb9f2739b1174bace5 Bug 459790 - "Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] )". r+sr=jst, a=mconnor.
Ben Turner <bent.mozilla@gmail.com>
parents: 21377
diff changeset
   308
22041
d50fb8c0d589999bbc8560223457cb37723cf9e0 Bug 459790 - 'Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] ).' Followup fix for JS impls. r+sr=jst, a=blocking1.9.1+
Ben Turner <bent.mozilla@gmail.com>
parents: 21852
diff changeset
   309
            // Don't report if reporting was disabled by someone else.
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   310
            if (!(oldOpts & JSOPTION_DONT_REPORT_UNCAUGHT))
22041
d50fb8c0d589999bbc8560223457cb37723cf9e0 Bug 459790 - 'Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] ).' Followup fix for JS impls. r+sr=jst, a=blocking1.9.1+
Ben Turner <bent.mozilla@gmail.com>
parents: 21852
diff changeset
   311
                JS_ReportPendingException(cx);
21852
13ebc220fad375ca6df4a9bb9f2739b1174bace5 Bug 459790 - "Following Error console link causes uncaught exception ( 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface] )". r+sr=jst, a=mconnor.
Ben Turner <bent.mozilla@gmail.com>
parents: 21377
diff changeset
   312
        }
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   313
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   314
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   315
    if (success)
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   316
        success = JS_ValueToObject(cx, retval, retObj.address());
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   317
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   318
    return success ? retObj.get() : nullptr;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   319
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   320
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   321
/***************************************************************************/
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   322
78739
014c9cf5088f1af09d9d3969771c9ef857b3dd78 Bug 688012 - Remove trailing whitespace within XPConnect. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78738
diff changeset
   323
static JSBool
014c9cf5088f1af09d9d3969771c9ef857b3dd78 Bug 688012 - Remove trailing whitespace within XPConnect. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78738
diff changeset
   324
GetNamedPropertyAsVariantRaw(XPCCallContext& ccx,
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   325
                             JSObject* aJSObj,
78739
014c9cf5088f1af09d9d3969771c9ef857b3dd78 Bug 688012 - Remove trailing whitespace within XPConnect. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78738
diff changeset
   326
                             jsid aName,
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   327
                             nsIVariant** aResult,
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   328
                             nsresult* pErr)
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   329
{
83645
69fe2af4da71132bc31b8866e1bb9e96a1f97a21 Bug 714057 - Remove uintn users from XPConnect; r=bholley+khuey
Ms2ger <ms2ger@gmail.com>
parents: 83298
diff changeset
   330
    nsXPTType type = nsXPTType((uint8_t)TD_INTERFACE_TYPE);
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   331
    RootedValue val(ccx);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   332
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   333
    return JS_GetPropertyById(ccx, aJSObj, aName, val.address()) &&
77538
1a6a02df6029e6feb263c534962a8f228957bb2e Bug 683802 - Pass useAllocator=false only for wrappedjs dipper params. Everything else can allocate. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 77535
diff changeset
   334
           // Note that this always takes the T_INTERFACE path through
1a6a02df6029e6feb263c534962a8f228957bb2e Bug 683802 - Pass useAllocator=false only for wrappedjs dipper params. Everything else can allocate. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 77535
diff changeset
   335
           // JSData2Native, so the value passed for useAllocator
1a6a02df6029e6feb263c534962a8f228957bb2e Bug 683802 - Pass useAllocator=false only for wrappedjs dipper params. Everything else can allocate. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 77535
diff changeset
   336
           // doesn't really matter. We pass true for consistency.
134048
9ab08f6d22582cc760e8dabf55da730556a7a0d0 Bug 877261 - Stop using XPCCallContext for XPCConvert. r=Ms2ger
Bobby Holley <bobbyholley@gmail.com>
parents: 133709
diff changeset
   337
           XPCConvert::JSData2Native(aResult, val, type, true,
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   338
                                     &NS_GET_IID(nsIVariant), pErr);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   339
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   340
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   341
// static
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   342
nsresult
78739
014c9cf5088f1af09d9d3969771c9ef857b3dd78 Bug 688012 - Remove trailing whitespace within XPConnect. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78738
diff changeset
   343
nsXPCWrappedJSClass::GetNamedPropertyAsVariant(XPCCallContext& ccx,
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   344
                                               JSObject* aJSObjArg,
88562
d4433c487dc8272fea12b1f3ab13a84560498f39 Bug 731804 - nsXPCWrappedJSClass::GetNamedPropertyAsVariant should jsvalify strings _after_ changing compartments. r=peterv
Bobby Holley <bobbyholley@gmail.com>
parents: 88308
diff changeset
   345
                                               const nsAString& aName,
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   346
                                               nsIVariant** aResult)
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   347
{
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   348
    JSContext* cx = ccx.GetJSContext();
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   349
    RootedObject aJSObj(cx, aJSObjArg);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   350
    JSBool ok;
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   351
    RootedId id(cx);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   352
    nsresult rv = NS_ERROR_FAILURE;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   353
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   354
    AutoScriptEvaluate scriptEval(cx);
61765
96570116d62a16fb7a04ba6fb6d694137f0dda1a Enter compartment in AutoScriptEvaluate (bug 630243, r=jst, a=blocker).
Andreas Gal <gal@mozilla.com>
parents: 61451
diff changeset
   355
    if (!scriptEval.StartEvaluating(aJSObj))
96570116d62a16fb7a04ba6fb6d694137f0dda1a Enter compartment in AutoScriptEvaluate (bug 630243, r=jst, a=blocker).
Andreas Gal <gal@mozilla.com>
parents: 61451
diff changeset
   356
        return NS_ERROR_FAILURE;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   357
88562
d4433c487dc8272fea12b1f3ab13a84560498f39 Bug 731804 - nsXPCWrappedJSClass::GetNamedPropertyAsVariant should jsvalify strings _after_ changing compartments. r=peterv
Bobby Holley <bobbyholley@gmail.com>
parents: 88308
diff changeset
   358
    // Wrap the string in a jsval after the AutoScriptEvaluate, so that the
d4433c487dc8272fea12b1f3ab13a84560498f39 Bug 731804 - nsXPCWrappedJSClass::GetNamedPropertyAsVariant should jsvalify strings _after_ changing compartments. r=peterv
Bobby Holley <bobbyholley@gmail.com>
parents: 88308
diff changeset
   359
    // resulting value ends up in the correct compartment.
d4433c487dc8272fea12b1f3ab13a84560498f39 Bug 731804 - nsXPCWrappedJSClass::GetNamedPropertyAsVariant should jsvalify strings _after_ changing compartments. r=peterv
Bobby Holley <bobbyholley@gmail.com>
parents: 88308
diff changeset
   360
    nsStringBuffer* buf;
d4433c487dc8272fea12b1f3ab13a84560498f39 Bug 731804 - nsXPCWrappedJSClass::GetNamedPropertyAsVariant should jsvalify strings _after_ changing compartments. r=peterv
Bobby Holley <bobbyholley@gmail.com>
parents: 88308
diff changeset
   361
    jsval jsstr = XPCStringConvert::ReadableToJSVal(ccx, aName, &buf);
d4433c487dc8272fea12b1f3ab13a84560498f39 Bug 731804 - nsXPCWrappedJSClass::GetNamedPropertyAsVariant should jsvalify strings _after_ changing compartments. r=peterv
Bobby Holley <bobbyholley@gmail.com>
parents: 88308
diff changeset
   362
    if (JSVAL_IS_NULL(jsstr))
d4433c487dc8272fea12b1f3ab13a84560498f39 Bug 731804 - nsXPCWrappedJSClass::GetNamedPropertyAsVariant should jsvalify strings _after_ changing compartments. r=peterv
Bobby Holley <bobbyholley@gmail.com>
parents: 88308
diff changeset
   363
        return NS_ERROR_OUT_OF_MEMORY;
d4433c487dc8272fea12b1f3ab13a84560498f39 Bug 731804 - nsXPCWrappedJSClass::GetNamedPropertyAsVariant should jsvalify strings _after_ changing compartments. r=peterv
Bobby Holley <bobbyholley@gmail.com>
parents: 88308
diff changeset
   364
    if (buf)
d4433c487dc8272fea12b1f3ab13a84560498f39 Bug 731804 - nsXPCWrappedJSClass::GetNamedPropertyAsVariant should jsvalify strings _after_ changing compartments. r=peterv
Bobby Holley <bobbyholley@gmail.com>
parents: 88308
diff changeset
   365
        buf->AddRef();
d4433c487dc8272fea12b1f3ab13a84560498f39 Bug 731804 - nsXPCWrappedJSClass::GetNamedPropertyAsVariant should jsvalify strings _after_ changing compartments. r=peterv
Bobby Holley <bobbyholley@gmail.com>
parents: 88308
diff changeset
   366
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   367
    ok = JS_ValueToId(cx, jsstr, id.address()) &&
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   368
        GetNamedPropertyAsVariantRaw(ccx, aJSObj, id, aResult, &rv);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   369
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   370
    return ok ? NS_OK : NS_FAILED(rv) ? rv : NS_ERROR_FAILURE;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   371
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   372
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   373
/***************************************************************************/
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   374
78739
014c9cf5088f1af09d9d3969771c9ef857b3dd78 Bug 688012 - Remove trailing whitespace within XPConnect. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78738
diff changeset
   375
// static
014c9cf5088f1af09d9d3969771c9ef857b3dd78 Bug 688012 - Remove trailing whitespace within XPConnect. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78738
diff changeset
   376
nsresult
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   377
nsXPCWrappedJSClass::BuildPropertyEnumerator(XPCCallContext& ccx,
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   378
                                             JSObject* aJSObjArg,
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   379
                                             nsISimpleEnumerator** aEnumerate)
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   380
{
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   381
    JSContext* cx = ccx.GetJSContext();
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   382
    RootedObject aJSObj(cx, aJSObjArg);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   383
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   384
    AutoScriptEvaluate scriptEval(cx);
61765
96570116d62a16fb7a04ba6fb6d694137f0dda1a Enter compartment in AutoScriptEvaluate (bug 630243, r=jst, a=blocker).
Andreas Gal <gal@mozilla.com>
parents: 61451
diff changeset
   385
    if (!scriptEval.StartEvaluating(aJSObj))
96570116d62a16fb7a04ba6fb6d694137f0dda1a Enter compartment in AutoScriptEvaluate (bug 630243, r=jst, a=blocker).
Andreas Gal <gal@mozilla.com>
parents: 61451
diff changeset
   386
        return NS_ERROR_FAILURE;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   387
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   388
    AutoIdArray idArray(cx, JS_Enumerate(cx, aJSObj));
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   389
    if (!idArray)
84175
2140f9cb5d6a7bbe8218888564f32cda7d58c32b Bug 332648 - Part g: Move AutoIdArray to jsapi.h; r=evilpie
Ms2ger <ms2ger@gmail.com>
parents: 84166
diff changeset
   390
        return NS_ERROR_FAILURE;
78739
014c9cf5088f1af09d9d3969771c9ef857b3dd78 Bug 688012 - Remove trailing whitespace within XPConnect. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78738
diff changeset
   391
84175
2140f9cb5d6a7bbe8218888564f32cda7d58c32b Bug 332648 - Part g: Move AutoIdArray to jsapi.h; r=evilpie
Ms2ger <ms2ger@gmail.com>
parents: 84166
diff changeset
   392
    nsCOMArray<nsIProperty> propertyArray(idArray.length());
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   393
    RootedId idName(cx);
84175
2140f9cb5d6a7bbe8218888564f32cda7d58c32b Bug 332648 - Part g: Move AutoIdArray to jsapi.h; r=evilpie
Ms2ger <ms2ger@gmail.com>
parents: 84166
diff changeset
   394
    for (size_t i = 0; i < idArray.length(); i++) {
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   395
        idName = idArray[i];
84175
2140f9cb5d6a7bbe8218888564f32cda7d58c32b Bug 332648 - Part g: Move AutoIdArray to jsapi.h; r=evilpie
Ms2ger <ms2ger@gmail.com>
parents: 84166
diff changeset
   396
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   397
        nsCOMPtr<nsIVariant> value;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   398
        nsresult rv;
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   399
        if (!GetNamedPropertyAsVariantRaw(ccx, aJSObj, idName,
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   400
                                          getter_AddRefs(value), &rv)) {
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   401
            if (NS_FAILED(rv))
84175
2140f9cb5d6a7bbe8218888564f32cda7d58c32b Bug 332648 - Part g: Move AutoIdArray to jsapi.h; r=evilpie
Ms2ger <ms2ger@gmail.com>
parents: 84166
diff changeset
   402
                return rv;
2140f9cb5d6a7bbe8218888564f32cda7d58c32b Bug 332648 - Part g: Move AutoIdArray to jsapi.h; r=evilpie
Ms2ger <ms2ger@gmail.com>
parents: 84166
diff changeset
   403
            return NS_ERROR_FAILURE;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   404
        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   405
129584
aa442c0ebfb229e8cce48d2726faba742f79b489 Bug 863289 - GC: Continue the rooting of XPConnect r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128952
diff changeset
   406
        RootedValue jsvalName(cx);
aa442c0ebfb229e8cce48d2726faba742f79b489 Bug 863289 - GC: Continue the rooting of XPConnect r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128952
diff changeset
   407
        if (!JS_IdToValue(cx, idName, jsvalName.address()))
84175
2140f9cb5d6a7bbe8218888564f32cda7d58c32b Bug 332648 - Part g: Move AutoIdArray to jsapi.h; r=evilpie
Ms2ger <ms2ger@gmail.com>
parents: 84166
diff changeset
   408
            return NS_ERROR_FAILURE;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   409
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   410
        JSString* name = JS_ValueToString(cx, jsvalName);
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   411
        if (!name)
84175
2140f9cb5d6a7bbe8218888564f32cda7d58c32b Bug 332648 - Part g: Move AutoIdArray to jsapi.h; r=evilpie
Ms2ger <ms2ger@gmail.com>
parents: 84166
diff changeset
   412
            return NS_ERROR_FAILURE;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   413
59889
cc6d97b432cc1911da7c8f5d5b3ed13322fefc4d Bug 609440, part 3 - remove fallible public APIs, update mozilla (r=bent,jst,mrbkap,waldo,sdwilsh)
Luke Wagner <lw@mozilla.com>
parents: 58977
diff changeset
   414
        size_t length;
cc6d97b432cc1911da7c8f5d5b3ed13322fefc4d Bug 609440, part 3 - remove fallible public APIs, update mozilla (r=bent,jst,mrbkap,waldo,sdwilsh)
Luke Wagner <lw@mozilla.com>
parents: 58977
diff changeset
   415
        const jschar *chars = JS_GetStringCharsAndLength(cx, name, &length);
cc6d97b432cc1911da7c8f5d5b3ed13322fefc4d Bug 609440, part 3 - remove fallible public APIs, update mozilla (r=bent,jst,mrbkap,waldo,sdwilsh)
Luke Wagner <lw@mozilla.com>
parents: 58977
diff changeset
   416
        if (!chars)
84175
2140f9cb5d6a7bbe8218888564f32cda7d58c32b Bug 332648 - Part g: Move AutoIdArray to jsapi.h; r=evilpie
Ms2ger <ms2ger@gmail.com>
parents: 84166
diff changeset
   417
            return NS_ERROR_FAILURE;
59889
cc6d97b432cc1911da7c8f5d5b3ed13322fefc4d Bug 609440, part 3 - remove fallible public APIs, update mozilla (r=bent,jst,mrbkap,waldo,sdwilsh)
Luke Wagner <lw@mozilla.com>
parents: 58977
diff changeset
   418
78739
014c9cf5088f1af09d9d3969771c9ef857b3dd78 Bug 688012 - Remove trailing whitespace within XPConnect. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78738
diff changeset
   419
        nsCOMPtr<nsIProperty> property =
102997
a16372ce30b5f6b747246b01fcd215a4bf3b6342 Bug 579517 - Part 1: Automated conversion of NSPR numeric types to stdint types in Gecko; r=bsmedberg
Ehsan Akhgari <ehsan@mozilla.com>
parents: 100875
diff changeset
   420
            new xpcProperty(chars, (uint32_t) length, value);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   421
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   422
        if (!propertyArray.AppendObject(property))
84175
2140f9cb5d6a7bbe8218888564f32cda7d58c32b Bug 332648 - Part g: Move AutoIdArray to jsapi.h; r=evilpie
Ms2ger <ms2ger@gmail.com>
parents: 84166
diff changeset
   423
            return NS_ERROR_FAILURE;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   424
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   425
84175
2140f9cb5d6a7bbe8218888564f32cda7d58c32b Bug 332648 - Part g: Move AutoIdArray to jsapi.h; r=evilpie
Ms2ger <ms2ger@gmail.com>
parents: 84166
diff changeset
   426
    return NS_NewArrayEnumerator(aEnumerate, propertyArray);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   427
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   428
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   429
/***************************************************************************/
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   430
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   431
NS_IMPL_ISUPPORTS1(xpcProperty, nsIProperty)
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   432
102997
a16372ce30b5f6b747246b01fcd215a4bf3b6342 Bug 579517 - Part 1: Automated conversion of NSPR numeric types to stdint types in Gecko; r=bsmedberg
Ehsan Akhgari <ehsan@mozilla.com>
parents: 100875
diff changeset
   433
xpcProperty::xpcProperty(const PRUnichar* aName, uint32_t aNameLen,
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   434
                         nsIVariant* aValue)
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   435
    : mName(aName, aNameLen), mValue(aValue)
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   436
{
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   437
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   438
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   439
/* readonly attribute AString name; */
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   440
NS_IMETHODIMP xpcProperty::GetName(nsAString & aName)
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   441
{
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   442
    aName.Assign(mName);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   443
    return NS_OK;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   444
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   445
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   446
/* readonly attribute nsIVariant value; */
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   447
NS_IMETHODIMP xpcProperty::GetValue(nsIVariant * *aValue)
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   448
{
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   449
    NS_ADDREF(*aValue = mValue);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   450
    return NS_OK;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   451
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   452
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   453
/***************************************************************************/
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   454
// This 'WrappedJSIdentity' class and singleton allow us to figure out if
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   455
// any given nsISupports* is implemented by a WrappedJS object. This is done
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   456
// using a QueryInterface call on the interface pointer with our ID. If
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   457
// that call returns NS_OK and the pointer is to our singleton, then the
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   458
// interface must be implemented by a WrappedJS object. NOTE: the
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   459
// 'WrappedJSIdentity' object is not a real XPCOM object and should not be
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   460
// used for anything else (hence it is declared in this implementation file).
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   461
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   462
// {5C5C3BB0-A9BA-11d2-BA64-00805F8A5DD7}
78740
ac22bf1a3e238428d70ede09ca6fd31f179884ec Bug 688012 - Move all multi-line continuation backslashes to column 79 (where possible). r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78739
diff changeset
   463
#define NS_IXPCONNECT_WRAPPED_JS_IDENTITY_CLASS_IID                           \
ac22bf1a3e238428d70ede09ca6fd31f179884ec Bug 688012 - Move all multi-line continuation backslashes to column 79 (where possible). r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78739
diff changeset
   464
{ 0x5c5c3bb0, 0xa9ba, 0x11d2,                                                 \
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   465
  { 0xba, 0x64, 0x0, 0x80, 0x5f, 0x8a, 0x5d, 0xd7 } }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   466
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   467
class WrappedJSIdentity
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   468
{
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   469
    // no instance methods...
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   470
public:
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   471
    NS_DECLARE_STATIC_IID_ACCESSOR(NS_IXPCONNECT_WRAPPED_JS_IDENTITY_CLASS_IID)
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   472
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   473
    static void* GetSingleton()
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   474
    {
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   475
        static WrappedJSIdentity* singleton = nullptr;
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   476
        if (!singleton)
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   477
            singleton = new WrappedJSIdentity();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   478
        return (void*) singleton;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   479
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   480
};
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   481
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   482
NS_DEFINE_STATIC_IID_ACCESSOR(WrappedJSIdentity,
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   483
                              NS_IXPCONNECT_WRAPPED_JS_IDENTITY_CLASS_IID)
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   484
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   485
/***************************************************************************/
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   486
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   487
// static
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   488
JSBool
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   489
nsXPCWrappedJSClass::IsWrappedJS(nsISupports* aPtr)
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   490
{
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   491
    void* result;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   492
    NS_PRECONDITION(aPtr, "null pointer");
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   493
    return aPtr &&
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   494
           NS_OK == aPtr->QueryInterface(NS_GET_IID(WrappedJSIdentity), &result) &&
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   495
           result == WrappedJSIdentity::GetSingleton();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   496
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   497
130100
e90cc4d3501ad757ef077c57307fb9b05591c1ac Bug 865308: GC: More rooting work in XPConnect r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 129733
diff changeset
   498
// NB: This will return the top JSContext on the JSContext stack if there is one,
e90cc4d3501ad757ef077c57307fb9b05591c1ac Bug 865308: GC: More rooting work in XPConnect r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 129733
diff changeset
   499
// before attempting to get the context from the wrapped JS object.
10291
626d450f525188920f599039520a90492585997c Bug 352791 - "Permission denied to get property XULElement.ownerDocument". Patch by Blake Kaplan <mrbkap@gmail.com>. r=jst,bzbarsky. sr=brendan. a=blocking1.9.
bent.mozilla@gmail.com
parents: 9633
diff changeset
   500
static JSContext *
130100
e90cc4d3501ad757ef077c57307fb9b05591c1ac Bug 865308: GC: More rooting work in XPConnect r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 129733
diff changeset
   501
GetContextFromObjectOrDefault(nsXPCWrappedJS* wrapper)
10291
626d450f525188920f599039520a90492585997c Bug 352791 - "Permission denied to get property XULElement.ownerDocument". Patch by Blake Kaplan <mrbkap@gmail.com>. r=jst,bzbarsky. sr=brendan. a=blocking1.9.
bent.mozilla@gmail.com
parents: 9633
diff changeset
   502
{
10857
390f9a624ba20a99cd4844eb02be02c5a3016f3c There might be a pushed context but no running code. bug 413200, r+sr=jst a=blocking-1.9+
mrbkap@gmail.com
parents: 10506
diff changeset
   503
    // Don't stomp over a running context.
97269
43340a612078e60ecc3263ae892a0269a0d2924d Bug 755255 - Make consumers of GetJSContextStack go through XPCJSRuntime. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 96584
diff changeset
   504
    XPCJSContextStack* stack = XPCJSRuntime::Get()->GetJSContextStack();
84160
df571c75b4c04ddfdc3a4a6dc97e5029d8446aca Bug 715634 - Cleanup XPCJSContextStack; r=bholley
Ms2ger <ms2ger@gmail.com>
parents: 83645
diff changeset
   505
    if (stack && stack->Peek())
130100
e90cc4d3501ad757ef077c57307fb9b05591c1ac Bug 865308: GC: More rooting work in XPConnect r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 129733
diff changeset
   506
        return stack->Peek();
10506
1e3d811bcdc50e823e5ed68d0f9d0b3c20f74d00 Use already running code's context when executing JS code from C++. bug 412598, r+sr=jst
mrbkap@gmail.com
parents: 10291
diff changeset
   507
10291
626d450f525188920f599039520a90492585997c Bug 352791 - "Permission denied to get property XULElement.ownerDocument". Patch by Blake Kaplan <mrbkap@gmail.com>. r=jst,bzbarsky. sr=brendan. a=blocking1.9.
bent.mozilla@gmail.com
parents: 9633
diff changeset
   508
    // In order to get a context, we need a context.
626d450f525188920f599039520a90492585997c Bug 352791 - "Permission denied to get property XULElement.ownerDocument". Patch by Blake Kaplan <mrbkap@gmail.com>. r=jst,bzbarsky. sr=brendan. a=blocking1.9.
bent.mozilla@gmail.com
parents: 9633
diff changeset
   509
    XPCCallContext ccx(NATIVE_CALLER);
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   510
    if (!ccx.IsValid())
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   511
        return nullptr;
55601
9dc0c11e8eb862a7f6ffcdaef0f4024f820c2562 Bug 580128 - Fix compartment warnings by entering. r=gal/peterv/jst/mrbkap/jorendorff (and written by all of us too).
Blake Kaplan <mrbkap@gmail.com>
parents: 54733
diff changeset
   512
130100
e90cc4d3501ad757ef077c57307fb9b05591c1ac Bug 865308: GC: More rooting work in XPConnect r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 129733
diff changeset
   513
    RootedObject obj(ccx, wrapper->GetJSObject());
103263
0d61ae018d9f97407a37e327ee526fb018619f62 Bug 625199 - s/JSAutoEnterCompartment/JSAutoCompartment/ and make it infallible (r=bholley)
Luke Wagner <luke@mozilla.com>
parents: 102997
diff changeset
   514
    JSAutoCompartment ac(ccx, obj);
111404
b011b2c888d14956b1d923b231c51c8371b1091a Bug 797821 - Address Ms2ger's review comments. r=me
Bobby Holley <bobbyholley@gmail.com>
parents: 111396
diff changeset
   515
    XPCWrappedNativeScope* scope = GetObjectScope(obj);
10291
626d450f525188920f599039520a90492585997c Bug 352791 - "Permission denied to get property XULElement.ownerDocument". Patch by Blake Kaplan <mrbkap@gmail.com>. r=jst,bzbarsky. sr=brendan. a=blocking1.9.
bent.mozilla@gmail.com
parents: 9633
diff changeset
   516
    XPCContext *xpcc = scope->GetContext();
10967
171cda5e93d39e0439e60c73ab623ad6fc38fc6e Fixing bug 414658. Make sure to not use a context from a different thread when calling functions on a wrapped JS object. r+sr=peterv@propagandism.org
jst@mozilla.org
parents: 10857
diff changeset
   517
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   518
    if (xpcc) {
10967
171cda5e93d39e0439e60c73ab623ad6fc38fc6e Fixing bug 414658. Make sure to not use a context from a different thread when calling functions on a wrapped JS object. r+sr=peterv@propagandism.org
jst@mozilla.org
parents: 10857
diff changeset
   519
        JSContext *cx = xpcc->GetJSContext();
85316
e517d4c431436772c46802f98618155ea8e37973 Bug 675078 - rm JSThreadData and JSThread (JSRuntime is now officially single-threaded) (r=igor,rs=mccr8)
Luke Wagner <luke@mozilla.com>
parents: 85309
diff changeset
   520
        JS_AbortIfWrongThread(JS_GetRuntime(cx));
e517d4c431436772c46802f98618155ea8e37973 Bug 675078 - rm JSThreadData and JSThread (JSRuntime is now officially single-threaded) (r=igor,rs=mccr8)
Luke Wagner <luke@mozilla.com>
parents: 85309
diff changeset
   521
        return cx;
10967
171cda5e93d39e0439e60c73ab623ad6fc38fc6e Fixing bug 414658. Make sure to not use a context from a different thread when calling functions on a wrapped JS object. r+sr=peterv@propagandism.org
jst@mozilla.org
parents: 10857
diff changeset
   522
    }
171cda5e93d39e0439e60c73ab623ad6fc38fc6e Fixing bug 414658. Make sure to not use a context from a different thread when calling functions on a wrapped JS object. r+sr=peterv@propagandism.org
jst@mozilla.org
parents: 10857
diff changeset
   523
130100
e90cc4d3501ad757ef077c57307fb9b05591c1ac Bug 865308: GC: More rooting work in XPConnect r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 129733
diff changeset
   524
    return XPCCallContext::GetDefaultJSContext();
10291
626d450f525188920f599039520a90492585997c Bug 352791 - "Permission denied to get property XULElement.ownerDocument". Patch by Blake Kaplan <mrbkap@gmail.com>. r=jst,bzbarsky. sr=brendan. a=blocking1.9.
bent.mozilla@gmail.com
parents: 9633
diff changeset
   525
}
626d450f525188920f599039520a90492585997c Bug 352791 - "Permission denied to get property XULElement.ownerDocument". Patch by Blake Kaplan <mrbkap@gmail.com>. r=jst,bzbarsky. sr=brendan. a=blocking1.9.
bent.mozilla@gmail.com
parents: 9633
diff changeset
   526
96584
3dd7e4d5c8f24b023ff11fad3eff24fc2fba83c7 Bug 758992 - Make the classes which use the XPCOM nsISupports implementation macros final, to avoid the warning about deleting using a pointer to a base class with virtual functions and no virtual dtor (xpconnect parts); r=bholley
Ehsan Akhgari <ehsan@mozilla.com>
parents: 96333
diff changeset
   527
class SameOriginCheckedComponent MOZ_FINAL : public nsISecurityCheckedComponent
28734
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   528
{
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   529
public:
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   530
    SameOriginCheckedComponent(nsXPCWrappedJS* delegate)
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   531
        : mDelegate(delegate)
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   532
    {}
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   533
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   534
    NS_DECL_ISUPPORTS
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   535
    NS_DECL_NSISECURITYCHECKEDCOMPONENT
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   536
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   537
private:
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   538
    nsRefPtr<nsXPCWrappedJS> mDelegate;
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   539
};
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   540
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   541
NS_IMPL_ADDREF(SameOriginCheckedComponent)
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   542
NS_IMPL_RELEASE(SameOriginCheckedComponent)
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   543
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   544
NS_INTERFACE_MAP_BEGIN(SameOriginCheckedComponent)
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   545
    NS_INTERFACE_MAP_ENTRY(nsISecurityCheckedComponent)
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   546
NS_INTERFACE_MAP_END_AGGREGATED(mDelegate)
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   547
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   548
NS_IMETHODIMP
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   549
SameOriginCheckedComponent::CanCreateWrapper(const nsIID * iid,
100223
fc4f105722ef11c244ee7f98c0aa6825ca84ad2d Bug 773637 - Kill NS_SCRIPTABLE annotations, Part 1: Remove NS_*PARAM annotations. r=ehsan
Joshua Cranmer <Pidgeot18@gmail.com>
parents: 97900
diff changeset
   550
                                             char **_retval)
28734
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   551
{
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   552
    // XXX This doesn't actually work because nsScriptSecurityManager doesn't
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   553
    // know what to do with "sameOrigin" for canCreateWrapper.
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   554
    *_retval = NS_strdup("sameOrigin");
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   555
    return *_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   556
}
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   557
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   558
NS_IMETHODIMP
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   559
SameOriginCheckedComponent::CanCallMethod(const nsIID * iid,
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   560
                                          const PRUnichar *methodName,
100223
fc4f105722ef11c244ee7f98c0aa6825ca84ad2d Bug 773637 - Kill NS_SCRIPTABLE annotations, Part 1: Remove NS_*PARAM annotations. r=ehsan
Joshua Cranmer <Pidgeot18@gmail.com>
parents: 97900
diff changeset
   561
                                          char **_retval)
28734
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   562
{
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   563
    *_retval = NS_strdup("sameOrigin");
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   564
    return *_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   565
}
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   566
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   567
NS_IMETHODIMP
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   568
SameOriginCheckedComponent::CanGetProperty(const nsIID * iid,
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   569
                                           const PRUnichar *propertyName,
100223
fc4f105722ef11c244ee7f98c0aa6825ca84ad2d Bug 773637 - Kill NS_SCRIPTABLE annotations, Part 1: Remove NS_*PARAM annotations. r=ehsan
Joshua Cranmer <Pidgeot18@gmail.com>
parents: 97900
diff changeset
   570
                                           char **_retval)
28734
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   571
{
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   572
    *_retval = NS_strdup("sameOrigin");
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   573
    return *_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   574
}
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   575
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   576
NS_IMETHODIMP
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   577
SameOriginCheckedComponent::CanSetProperty(const nsIID * iid,
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   578
                                           const PRUnichar *propertyName,
100223
fc4f105722ef11c244ee7f98c0aa6825ca84ad2d Bug 773637 - Kill NS_SCRIPTABLE annotations, Part 1: Remove NS_*PARAM annotations. r=ehsan
Joshua Cranmer <Pidgeot18@gmail.com>
parents: 97900
diff changeset
   579
                                           char **_retval)
28734
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   580
{
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   581
    *_retval = NS_strdup("sameOrigin");
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   582
    return *_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   583
}
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   584
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   585
NS_IMETHODIMP
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   586
nsXPCWrappedJSClass::DelegatedQueryInterface(nsXPCWrappedJS* self,
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   587
                                             REFNSIID aIID,
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   588
                                             void** aInstancePtr)
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   589
{
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   590
    if (aIID.Equals(NS_GET_IID(nsIXPConnectJSObjectHolder))) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   591
        NS_ADDREF(self);
3233
ab58bdbde9e03330d3a406d8b95aa3877152cf36 Bug 348748 - Replace all instances of NS_STATIC_CAST and friends with C++ casts (and simultaneously bitrot nearly every patch in existence). r=bsmedberg on the script that did this. Tune in next time for Macro Wars: Episode II: Attack on the LL_* Macros.
jwalden@mit.edu
parents: 2456
diff changeset
   592
        *aInstancePtr = (void*) static_cast<nsIXPConnectJSObjectHolder*>(self);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   593
        return NS_OK;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   594
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   595
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   596
    // Objects internal to xpconnect are the only objects that even know *how*
9633
742800b57f44e17e271a7a528ffd1d7d207dcf0a Kick the stupid Windows tinderbox.
jwalden@mit.edu
parents: 8388
diff changeset
   597
    // to ask for this iid. And none of them bother refcounting the thing.
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   598
    if (aIID.Equals(NS_GET_IID(WrappedJSIdentity))) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   599
        // asking to find out if this is a wrapper object
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   600
        *aInstancePtr = WrappedJSIdentity::GetSingleton();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   601
        return NS_OK;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   602
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   603
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   604
    if (aIID.Equals(NS_GET_IID(nsIPropertyBag))) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   605
        // We only want to expose one implementation from our aggregate.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   606
        nsXPCWrappedJS* root = self->GetRootWrapper();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   607
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   608
        if (!root->IsValid()) {
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   609
            *aInstancePtr = nullptr;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   610
            return NS_NOINTERFACE;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   611
        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   612
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   613
        NS_ADDREF(root);
3233
ab58bdbde9e03330d3a406d8b95aa3877152cf36 Bug 348748 - Replace all instances of NS_STATIC_CAST and friends with C++ casts (and simultaneously bitrot nearly every patch in existence). r=bsmedberg on the script that did this. Tune in next time for Macro Wars: Episode II: Attack on the LL_* Macros.
jwalden@mit.edu
parents: 2456
diff changeset
   614
        *aInstancePtr = (void*) static_cast<nsIPropertyBag*>(root);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   615
        return NS_OK;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   616
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   617
27646
d50609a6b63e0c5977f9c034bbebfe03015607eb Bug 489440 - Don't call into JS when asked if we support a wrapper cache. r+sr=peterv
Blake Kaplan <mrbkap@gmail.com>
parents: 27611
diff changeset
   618
    // We can't have a cached wrapper.
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   619
    if (aIID.Equals(NS_GET_IID(nsWrapperCache))) {
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   620
        *aInstancePtr = nullptr;
27646
d50609a6b63e0c5977f9c034bbebfe03015607eb Bug 489440 - Don't call into JS when asked if we support a wrapper cache. r+sr=peterv
Blake Kaplan <mrbkap@gmail.com>
parents: 27611
diff changeset
   621
        return NS_NOINTERFACE;
d50609a6b63e0c5977f9c034bbebfe03015607eb Bug 489440 - Don't call into JS when asked if we support a wrapper cache. r+sr=peterv
Blake Kaplan <mrbkap@gmail.com>
parents: 27611
diff changeset
   622
    }
10291
626d450f525188920f599039520a90492585997c Bug 352791 - "Permission denied to get property XULElement.ownerDocument". Patch by Blake Kaplan <mrbkap@gmail.com>. r=jst,bzbarsky. sr=brendan. a=blocking1.9.
bent.mozilla@gmail.com
parents: 9633
diff changeset
   623
130100
e90cc4d3501ad757ef077c57307fb9b05591c1ac Bug 865308: GC: More rooting work in XPConnect r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 129733
diff changeset
   624
    JSContext *context = GetContextFromObjectOrDefault(self);
10291
626d450f525188920f599039520a90492585997c Bug 352791 - "Permission denied to get property XULElement.ownerDocument". Patch by Blake Kaplan <mrbkap@gmail.com>. r=jst,bzbarsky. sr=brendan. a=blocking1.9.
bent.mozilla@gmail.com
parents: 9633
diff changeset
   625
    XPCCallContext ccx(NATIVE_CALLER, context);
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   626
    if (!ccx.IsValid()) {
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   627
        *aInstancePtr = nullptr;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   628
        return NS_NOINTERFACE;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   629
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   630
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   631
    // We support nsISupportsWeakReference iff the root wrapped JSObject
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   632
    // claims to support it in its QueryInterface implementation.
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   633
    if (aIID.Equals(NS_GET_IID(nsISupportsWeakReference))) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   634
        // We only want to expose one implementation from our aggregate.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   635
        nsXPCWrappedJS* root = self->GetRootWrapper();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   636
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   637
        // Fail if JSObject doesn't claim support for nsISupportsWeakReference
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   638
        if (!root->IsValid() ||
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   639
            !CallQueryInterfaceOnJSObject(ccx, root->GetJSObject(), aIID)) {
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   640
            *aInstancePtr = nullptr;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   641
            return NS_NOINTERFACE;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   642
        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   643
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   644
        NS_ADDREF(root);
3233
ab58bdbde9e03330d3a406d8b95aa3877152cf36 Bug 348748 - Replace all instances of NS_STATIC_CAST and friends with C++ casts (and simultaneously bitrot nearly every patch in existence). r=bsmedberg on the script that did this. Tune in next time for Macro Wars: Episode II: Attack on the LL_* Macros.
jwalden@mit.edu
parents: 2456
diff changeset
   645
        *aInstancePtr = (void*) static_cast<nsISupportsWeakReference*>(root);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   646
        return NS_OK;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   647
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   648
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   649
    nsXPCWrappedJS* sibling;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   650
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   651
    // Checks for any existing wrapper explicitly constructed for this iid.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   652
    // This includes the current 'self' wrapper. This also deals with the
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   653
    // nsISupports case (for which it returns mRoot).
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   654
    if (nullptr != (sibling = self->Find(aIID))) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   655
        NS_ADDREF(sibling);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   656
        *aInstancePtr = sibling->GetXPTCStub();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   657
        return NS_OK;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   658
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   659
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   660
    // Check if asking for an interface from which one of our wrappers inherits.
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   661
    if (nullptr != (sibling = self->FindInherited(aIID))) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   662
        NS_ADDREF(sibling);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   663
        *aInstancePtr = sibling->GetXPTCStub();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   664
        return NS_OK;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   665
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   666
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   667
    // else we do the more expensive stuff...
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   668
2456
71cf754e77b982fb987bfa436aec3c8fe7acfcc2 Restrict who can claim to implement nsISecurityCheckedComponent. bug 352882, r=jst sr=bzbarsky
mrbkap@gmail.com
parents: 1
diff changeset
   669
    // Before calling out, ensure that we're not about to claim to implement
71cf754e77b982fb987bfa436aec3c8fe7acfcc2 Restrict who can claim to implement nsISecurityCheckedComponent. bug 352882, r=jst sr=bzbarsky
mrbkap@gmail.com
parents: 1
diff changeset
   670
    // nsISecurityCheckedComponent for an untrusted object. Doing so causes
71cf754e77b982fb987bfa436aec3c8fe7acfcc2 Restrict who can claim to implement nsISecurityCheckedComponent. bug 352882, r=jst sr=bzbarsky
mrbkap@gmail.com
parents: 1
diff changeset
   671
    // problems. See bug 352882.
28734
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   672
    // But if this is a content object, then we might be wrapping it for
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   673
    // content. If our JS object isn't a double-wrapped object (that is, we
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   674
    // don't have XPCWrappedJS(XPCWrappedNative(some C++ object))), then it
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   675
    // definitely will not have classinfo (and therefore won't be a DOM
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   676
    // object). Since content wants to be able to use these objects (directly
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   677
    // or indirectly, see bug 483672), we implement nsISecurityCheckedComponent
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   678
    // for them and tell caps that they are also bound by the same origin
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   679
    // model.
2456
71cf754e77b982fb987bfa436aec3c8fe7acfcc2 Restrict who can claim to implement nsISecurityCheckedComponent. bug 352882, r=jst sr=bzbarsky
mrbkap@gmail.com
parents: 1
diff changeset
   680
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   681
    if (aIID.Equals(NS_GET_IID(nsISecurityCheckedComponent))) {
2456
71cf754e77b982fb987bfa436aec3c8fe7acfcc2 Restrict who can claim to implement nsISecurityCheckedComponent. bug 352882, r=jst sr=bzbarsky
mrbkap@gmail.com
parents: 1
diff changeset
   682
        // XXX This code checks to see if the given object has chrome (also
71cf754e77b982fb987bfa436aec3c8fe7acfcc2 Restrict who can claim to implement nsISecurityCheckedComponent. bug 352882, r=jst sr=bzbarsky
mrbkap@gmail.com
parents: 1
diff changeset
   683
        // known as system) principals. It really wants to do a
71cf754e77b982fb987bfa436aec3c8fe7acfcc2 Restrict who can claim to implement nsISecurityCheckedComponent. bug 352882, r=jst sr=bzbarsky
mrbkap@gmail.com
parents: 1
diff changeset
   684
        // UniversalXPConnect type check.
71cf754e77b982fb987bfa436aec3c8fe7acfcc2 Restrict who can claim to implement nsISecurityCheckedComponent. bug 352882, r=jst sr=bzbarsky
mrbkap@gmail.com
parents: 1
diff changeset
   685
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   686
        *aInstancePtr = nullptr;
28734
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   687
133709
eea9248f39a92afe4890c4c4962ef5b7fe1b6df8 bug 873622 - speed up nsXPConnect::GetXPConnect() and rename it since it never returns null r=bholley
Trevor Saunders <trev.saunders@gmail.com>
parents: 133564
diff changeset
   688
        nsXPConnect *xpc = nsXPConnect::XPConnect();
2456
71cf754e77b982fb987bfa436aec3c8fe7acfcc2 Restrict who can claim to implement nsISecurityCheckedComponent. bug 352882, r=jst sr=bzbarsky
mrbkap@gmail.com
parents: 1
diff changeset
   689
        nsCOMPtr<nsIScriptSecurityManager> secMan =
71cf754e77b982fb987bfa436aec3c8fe7acfcc2 Restrict who can claim to implement nsISecurityCheckedComponent. bug 352882, r=jst sr=bzbarsky
mrbkap@gmail.com
parents: 1
diff changeset
   690
            do_QueryInterface(xpc->GetDefaultSecurityManager());
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   691
        if (!secMan)
2456
71cf754e77b982fb987bfa436aec3c8fe7acfcc2 Restrict who can claim to implement nsISecurityCheckedComponent. bug 352882, r=jst sr=bzbarsky
mrbkap@gmail.com
parents: 1
diff changeset
   692
            return NS_NOINTERFACE;
28734
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   693
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   694
        RootedObject selfObj(ccx, self->GetJSObject());
2456
71cf754e77b982fb987bfa436aec3c8fe7acfcc2 Restrict who can claim to implement nsISecurityCheckedComponent. bug 352882, r=jst sr=bzbarsky
mrbkap@gmail.com
parents: 1
diff changeset
   695
        nsCOMPtr<nsIPrincipal> objPrin;
28734
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   696
        nsresult rv = secMan->GetObjectPrincipal(ccx, selfObj,
2456
71cf754e77b982fb987bfa436aec3c8fe7acfcc2 Restrict who can claim to implement nsISecurityCheckedComponent. bug 352882, r=jst sr=bzbarsky
mrbkap@gmail.com
parents: 1
diff changeset
   697
                                                 getter_AddRefs(objPrin));
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   698
        if (NS_FAILED(rv))
28734
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   699
            return rv;
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   700
77799
e7854b4d29ba905ae3994f821b160c989bac4260 Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
Michael Wu <mwu@mozilla.com>
parents: 77538
diff changeset
   701
        bool isSystem;
28734
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   702
        rv = secMan->IsSystemPrincipal(objPrin, &isSystem);
135085
aed026a38816dce5355eb6e2f871162a154b51bd Bug 851465 - Remove slim wrappers - remove slim wrapper macros and rename WN macros. r=bholley.
Peter Van der Beken <peterv@propagandism.org>
parents: 134714
diff changeset
   703
        if ((NS_FAILED(rv) || !isSystem) && !IS_WN_REFLECTOR(selfObj)) {
28734
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   704
            // A content object.
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   705
            nsRefPtr<SameOriginCheckedComponent> checked =
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   706
                new SameOriginCheckedComponent(self);
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   707
            if (!checked)
28734
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   708
                return NS_ERROR_OUT_OF_MEMORY;
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   709
            *aInstancePtr = checked.forget().get();
ba3b363f2ba14b00533dc04b2a7dd0be7aaaf705 Re-landing backed out part of bug 483672 for parity with 1.9.1
Johnny Stenback <jst@mozilla.com>
parents: 28714
diff changeset
   710
            return NS_OK;
2456
71cf754e77b982fb987bfa436aec3c8fe7acfcc2 Restrict who can claim to implement nsISecurityCheckedComponent. bug 352882, r=jst sr=bzbarsky
mrbkap@gmail.com
parents: 1
diff changeset
   711
        }
71cf754e77b982fb987bfa436aec3c8fe7acfcc2 Restrict who can claim to implement nsISecurityCheckedComponent. bug 352882, r=jst sr=bzbarsky
mrbkap@gmail.com
parents: 1
diff changeset
   712
    }
71cf754e77b982fb987bfa436aec3c8fe7acfcc2 Restrict who can claim to implement nsISecurityCheckedComponent. bug 352882, r=jst sr=bzbarsky
mrbkap@gmail.com
parents: 1
diff changeset
   713
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   714
    // check if the JSObject claims to implement this interface
129733
233f42abf005885675622decfd19712ff71f957c Bug 861912 - GC: Remove use of AUTO_MARK_JSVAL in XPConnect r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 129732
diff changeset
   715
    RootedObject jsobj(ccx, CallQueryInterfaceOnJSObject(ccx, self->GetJSObject(),
233f42abf005885675622decfd19712ff71f957c Bug 861912 - GC: Remove use of AUTO_MARK_JSVAL in XPConnect r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 129732
diff changeset
   716
                                                         aIID));
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   717
    if (jsobj) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   718
        // We can't use XPConvert::JSObject2NativeInterface() here
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   719
        // since that can find a XPCWrappedNative directly on the
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   720
        // proto chain, and we don't want that here. We need to find
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   721
        // the actual JS object that claimed it supports the interface
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   722
        // we're looking for or we'll potentially bypass security
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   723
        // checks etc by calling directly through to a native found on
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   724
        // the prototype chain.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   725
        //
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   726
        // Instead, simply do the nsXPCWrappedJS part of
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   727
        // XPConvert::JSObject2NativeInterface() here to make sure we
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   728
        // get a new (or used) nsXPCWrappedJS.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   729
        nsXPCWrappedJS* wrapper;
134049
29351d714861a336258ee3484d04f057ac8aca5f Bug 877261 - Stop taking a cx in XPCWrappedJS::GetNewOrUsed. r=Ms2ger
Bobby Holley <bobbyholley@gmail.com>
parents: 134048
diff changeset
   730
        nsresult rv = nsXPCWrappedJS::GetNewOrUsed(jsobj, aIID, nullptr,
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   731
                                                   &wrapper);
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   732
        if (NS_SUCCEEDED(rv) && wrapper) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   733
            // We need to go through the QueryInterface logic to make
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   734
            // this return the right thing for the various 'special'
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   735
            // interfaces; e.g.  nsIPropertyBag.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   736
            rv = wrapper->QueryInterface(aIID, aInstancePtr);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   737
            NS_RELEASE(wrapper);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   738
            return rv;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   739
        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   740
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   741
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   742
    // else...
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   743
    // no can do
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   744
    *aInstancePtr = nullptr;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   745
    return NS_NOINTERFACE;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   746
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   747
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   748
JSObject*
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   749
nsXPCWrappedJSClass::GetRootJSObject(JSContext* cx, JSObject* aJSObjArg)
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   750
{
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
   751
    RootedObject aJSObj(cx, aJSObjArg);
107626
343dde4d974df3f3d46ff22b5bfec24fe60b7983 Bug 785096 - part2: Removing XPCCallContext dependency from XPCVariant; r=bholley
Gabor Krizsanits <gkrizsanits@mozilla.com>
parents: 106784
diff changeset
   752
    JSObject* result = CallQueryInterfaceOnJSObject(cx, aJSObj,
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   753
                                                    NS_GET_IID(nsISupports));
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   754
    if (!result)
27664
da473f63b7edd2b552032f0843d0e9ad043b5b64 Bug 475864 - Move native anonymous content checks into a wrapper so that quickstubs don't sidestep them. r=jst sr=bzbarsky
Blake Kaplan <mrbkap@gmail.com>
parents: 27646
diff changeset
   755
        return aJSObj;
128491
4add88d3db6959db49c8f1c47b0d8537539fa969 Bug 854503 - Rename JS unwrapping functions. r=bholley
Jacek Szpot <maligree@gmail.com>
parents: 127899
diff changeset
   756
    JSObject* inner = js::UncheckedUnwrap(result);
27664
da473f63b7edd2b552032f0843d0e9ad043b5b64 Bug 475864 - Move native anonymous content checks into a wrapper so that quickstubs don't sidestep them. r=jst sr=bzbarsky
Blake Kaplan <mrbkap@gmail.com>
parents: 27646
diff changeset
   757
    if (inner)
da473f63b7edd2b552032f0843d0e9ad043b5b64 Bug 475864 - Move native anonymous content checks into a wrapper so that quickstubs don't sidestep them. r=jst sr=bzbarsky
Blake Kaplan <mrbkap@gmail.com>
parents: 27646
diff changeset
   758
        return inner;
da473f63b7edd2b552032f0843d0e9ad043b5b64 Bug 475864 - Move native anonymous content checks into a wrapper so that quickstubs don't sidestep them. r=jst sr=bzbarsky
Blake Kaplan <mrbkap@gmail.com>
parents: 27646
diff changeset
   759
    return result;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   760
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   761
18907
e71240d4b28c3c520a3faa951c946c3f7d7cb924 Bug 398946 - Remove JS_STATIC_DLL_CALLBACK and JS_DLL_CALLBACK from the tree; r=(benjamin + bent.mozilla)
Arpad Borsos <arpad.borsos@googlemail.com>
parents: 14721
diff changeset
   762
void
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   763
xpcWrappedJSErrorReporter(JSContext *cx, const char *message,
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   764
                          JSErrorReport *report)
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   765
{
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   766
    if (report) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   767
        // If it is an exception report, then we can just deal with the
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   768
        // exception later (if not caught in the JS code).
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   769
        if (JSREPORT_IS_EXCEPTION(report->flags)) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   770
            // XXX We have a problem with error reports from uncaught exceptions.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   771
            //
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   772
            // http://bugzilla.mozilla.org/show_bug.cgi?id=66453
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   773
            //
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   774
            // The issue is...
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   775
            //
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   776
            // We can't assume that the exception will *stay* uncaught. So, if
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   777
            // we build an nsIXPCException here and the underlying exception
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   778
            // really is caught before our script is done running then we blow
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   779
            // it by returning failure to our caller when the script didn't
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   780
            // really fail. However, This report contains error location info
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   781
            // that is no longer available after the script is done. So, if the
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   782
            // exception really is not caught (and is a non-engine exception)
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   783
            // then we've lost the oportunity to capture the script location
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   784
            // info that we *could* have captured here.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   785
            //
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   786
            // This is expecially an issue with nested evaluations.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   787
            //
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   788
            // Perhaps we could capture an expception here and store it as
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   789
            // 'provisional' and then later if there is a pending exception
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   790
            // when the script is done then we could maybe compare that in some
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   791
            // way with the 'provisional' one in which we captured location info.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   792
            // We would not want to assume that the one discovered here is the
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   793
            // same one that is later detected. This could cause us to lie.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   794
            //
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   795
            // The thing is. we do not currently store the right stuff to compare
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   796
            // these two nsIXPCExceptions (triggered by the same exception jsval
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   797
            // in the engine). Maybe we should store the jsval and compare that?
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   798
            // Maybe without even rooting it since we will not dereference it.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   799
            // This is inexact, but maybe the right thing to do?
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   800
            //
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   801
            // if (report->errorNumber == JSMSG_UNCAUGHT_EXCEPTION)) ...
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   802
            //
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   803
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   804
            return;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   805
        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   806
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   807
        if (JSREPORT_IS_WARNING(report->flags)) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   808
            // XXX printf the warning (#ifdef DEBUG only!).
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   809
            // XXX send the warning to the console service.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   810
            return;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   811
        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   812
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   813
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   814
    XPCCallContext ccx(NATIVE_CALLER, cx);
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   815
    if (!ccx.IsValid())
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   816
        return;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   817
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   818
    nsCOMPtr<nsIException> e;
134048
9ab08f6d22582cc760e8dabf55da730556a7a0d0 Bug 877261 - Stop using XPCCallContext for XPCConvert. r=Ms2ger
Bobby Holley <bobbyholley@gmail.com>
parents: 133709
diff changeset
   819
    XPCConvert::JSErrorToXPCException(message, nullptr, nullptr, report,
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   820
                                      getter_AddRefs(e));
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   821
    if (e)
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   822
        ccx.GetXPCContext()->SetException(e);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   823
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   824
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   825
JSBool
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   826
nsXPCWrappedJSClass::GetArraySizeFromParam(JSContext* cx,
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   827
                                           const XPTMethodDescriptor* method,
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   828
                                           const nsXPTParamInfo& param,
83645
69fe2af4da71132bc31b8866e1bb9e96a1f97a21 Bug 714057 - Remove uintn users from XPConnect; r=bholley+khuey
Ms2ger <ms2ger@gmail.com>
parents: 83298
diff changeset
   829
                                           uint16_t methodIndex,
69fe2af4da71132bc31b8866e1bb9e96a1f97a21 Bug 714057 - Remove uintn users from XPConnect; r=bholley+khuey
Ms2ger <ms2ger@gmail.com>
parents: 83298
diff changeset
   830
                                           uint8_t paramIndex,
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   831
                                           nsXPTCMiniVariant* nativeParams,
82768
d6d732ef5650562f1f1593df4bd446614e3f2dfa Bug 708735 - Use <stdint.h> types in JSAPI and throughout SpiderMonkey. Continue to provide the {u,}int{8,16,32,64} and JS{Uint,Int}{8,16,32,64} integer types through a single header, however, for a simpler backout strategy -- and also to ease the transition for embedders. r=timeless on switching the jsd API to use the <stdint.h> types, r=luke, r=dmandelin
Jeff Walden <jwalden@mit.edu>
parents: 80807
diff changeset
   832
                                           uint32_t* result)
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   833
{
83645
69fe2af4da71132bc31b8866e1bb9e96a1f97a21 Bug 714057 - Remove uintn users from XPConnect; r=bholley+khuey
Ms2ger <ms2ger@gmail.com>
parents: 83298
diff changeset
   834
    uint8_t argnum;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   835
    nsresult rv;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   836
79867
104c466724acd2cb7e9d3b648d140f355510bb15 Bug 677788 - Remove use of length_is xpt value from gecko. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 79866
diff changeset
   837
    rv = mInfo->GetSizeIsArgNumberForParam(methodIndex, &param, 0, &argnum);
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   838
    if (NS_FAILED(rv))
80807
3258ba3a269d5e865b720c853120e088d4537e10 Bug 701467 - Remove JS_TRUE/JS_FALSE from xpconnect; r=bholley
Ms2ger <ms2ger@gmail.com>
parents: 80787
diff changeset
   839
        return false;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   840
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   841
    const nsXPTParamInfo& arg_param = method->params[argnum];
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   842
80786
42ab175e8d8108c825b18d304146ae3465e0ca61 Bug 692342 - Remove the obviously superfluous uses of IsPointer(). r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 80659
diff changeset
   843
    // This should be enforced by the xpidl compiler, but it's not.
42ab175e8d8108c825b18d304146ae3465e0ca61 Bug 692342 - Remove the obviously superfluous uses of IsPointer(). r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 80659
diff changeset
   844
    // See bug 695235.
134714
b8d033f67ca35fadeac4250e2715686c79bdf139 Bug 881358 - Kill build warnings in XPConnect; r=bholley
Ms2ger <ms2ger@gmail.com>
parents: 134633
diff changeset
   845
    NS_ABORT_IF_FALSE(arg_param.GetType().TagPart() == nsXPTType::T_U32,
80786
42ab175e8d8108c825b18d304146ae3465e0ca61 Bug 692342 - Remove the obviously superfluous uses of IsPointer(). r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 80659
diff changeset
   846
                      "size_is references parameter of invalid type.");
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   847
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   848
    if (arg_param.IsIndirect())
82768
d6d732ef5650562f1f1593df4bd446614e3f2dfa Bug 708735 - Use <stdint.h> types in JSAPI and throughout SpiderMonkey. Continue to provide the {u,}int{8,16,32,64} and JS{Uint,Int}{8,16,32,64} integer types through a single header, however, for a simpler backout strategy -- and also to ease the transition for embedders. r=timeless on switching the jsd API to use the <stdint.h> types, r=luke, r=dmandelin
Jeff Walden <jwalden@mit.edu>
parents: 80807
diff changeset
   849
        *result = *(uint32_t*)nativeParams[argnum].val.p;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   850
    else
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   851
        *result = nativeParams[argnum].val.u32;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   852
80807
3258ba3a269d5e865b720c853120e088d4537e10 Bug 701467 - Remove JS_TRUE/JS_FALSE from xpconnect; r=bholley
Ms2ger <ms2ger@gmail.com>
parents: 80787
diff changeset
   853
    return true;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   854
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   855
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   856
JSBool
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   857
nsXPCWrappedJSClass::GetInterfaceTypeFromParam(JSContext* cx,
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   858
                                               const XPTMethodDescriptor* method,
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   859
                                               const nsXPTParamInfo& param,
83645
69fe2af4da71132bc31b8866e1bb9e96a1f97a21 Bug 714057 - Remove uintn users from XPConnect; r=bholley+khuey
Ms2ger <ms2ger@gmail.com>
parents: 83298
diff changeset
   860
                                               uint16_t methodIndex,
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   861
                                               const nsXPTType& type,
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   862
                                               nsXPTCMiniVariant* nativeParams,
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   863
                                               nsID* result)
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   864
{
83645
69fe2af4da71132bc31b8866e1bb9e96a1f97a21 Bug 714057 - Remove uintn users from XPConnect; r=bholley+khuey
Ms2ger <ms2ger@gmail.com>
parents: 83298
diff changeset
   865
    uint8_t type_tag = type.TagPart();
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   866
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   867
    if (type_tag == nsXPTType::T_INTERFACE) {
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   868
        if (NS_SUCCEEDED(GetInterfaceInfo()->
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   869
                         GetIIDForParamNoAlloc(methodIndex, &param, result))) {
80807
3258ba3a269d5e865b720c853120e088d4537e10 Bug 701467 - Remove JS_TRUE/JS_FALSE from xpconnect; r=bholley
Ms2ger <ms2ger@gmail.com>
parents: 80787
diff changeset
   870
            return true;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   871
        }
78744
25a5c9891392c72ac42f2771176d3f0d803ae890 Bug 688012 - Hoist 'else' clauses to the line of the previous close-curly-brace. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78743
diff changeset
   872
    } else if (type_tag == nsXPTType::T_INTERFACE_IS) {
83645
69fe2af4da71132bc31b8866e1bb9e96a1f97a21 Bug 714057 - Remove uintn users from XPConnect; r=bholley+khuey
Ms2ger <ms2ger@gmail.com>
parents: 83298
diff changeset
   873
        uint8_t argnum;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   874
        nsresult rv;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   875
        rv = mInfo->GetInterfaceIsArgNumberForParam(methodIndex,
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   876
                                                    &param, &argnum);
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   877
        if (NS_FAILED(rv))
80807
3258ba3a269d5e865b720c853120e088d4537e10 Bug 701467 - Remove JS_TRUE/JS_FALSE from xpconnect; r=bholley
Ms2ger <ms2ger@gmail.com>
parents: 80787
diff changeset
   878
            return false;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   879
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   880
        const nsXPTParamInfo& arg_param = method->params[argnum];
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   881
        const nsXPTType& arg_type = arg_param.GetType();
80786
42ab175e8d8108c825b18d304146ae3465e0ca61 Bug 692342 - Remove the obviously superfluous uses of IsPointer(). r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 80659
diff changeset
   882
42ab175e8d8108c825b18d304146ae3465e0ca61 Bug 692342 - Remove the obviously superfluous uses of IsPointer(). r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 80659
diff changeset
   883
        if (arg_type.TagPart() == nsXPTType::T_IID) {
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   884
            if (arg_param.IsIndirect()) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   885
                nsID** p = (nsID**) nativeParams[argnum].val.p;
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   886
                if (!p || !*p)
80807
3258ba3a269d5e865b720c853120e088d4537e10 Bug 701467 - Remove JS_TRUE/JS_FALSE from xpconnect; r=bholley
Ms2ger <ms2ger@gmail.com>
parents: 80787
diff changeset
   887
                    return false;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   888
                *result = **p;
78744
25a5c9891392c72ac42f2771176d3f0d803ae890 Bug 688012 - Hoist 'else' clauses to the line of the previous close-curly-brace. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78743
diff changeset
   889
            } else {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   890
                nsID* p = (nsID*) nativeParams[argnum].val.p;
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   891
                if (!p)
80807
3258ba3a269d5e865b720c853120e088d4537e10 Bug 701467 - Remove JS_TRUE/JS_FALSE from xpconnect; r=bholley
Ms2ger <ms2ger@gmail.com>
parents: 80787
diff changeset
   892
                    return false;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   893
                *result = *p;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   894
            }
80807
3258ba3a269d5e865b720c853120e088d4537e10 Bug 701467 - Remove JS_TRUE/JS_FALSE from xpconnect; r=bholley
Ms2ger <ms2ger@gmail.com>
parents: 80787
diff changeset
   895
            return true;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   896
        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   897
    }
80807
3258ba3a269d5e865b720c853120e088d4537e10 Bug 701467 - Remove JS_TRUE/JS_FALSE from xpconnect; r=bholley
Ms2ger <ms2ger@gmail.com>
parents: 80787
diff changeset
   898
    return false;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   899
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   900
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   901
void
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   902
nsXPCWrappedJSClass::CleanupPointerArray(const nsXPTType& datum_type,
82768
d6d732ef5650562f1f1593df4bd446614e3f2dfa Bug 708735 - Use <stdint.h> types in JSAPI and throughout SpiderMonkey. Continue to provide the {u,}int{8,16,32,64} and JS{Uint,Int}{8,16,32,64} integer types through a single header, however, for a simpler backout strategy -- and also to ease the transition for embedders. r=timeless on switching the jsd API to use the <stdint.h> types, r=luke, r=dmandelin
Jeff Walden <jwalden@mit.edu>
parents: 80807
diff changeset
   903
                                         uint32_t array_count,
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   904
                                         void** arrayp)
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   905
{
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   906
    if (datum_type.IsInterfacePointer()) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   907
        nsISupports** pp = (nsISupports**) arrayp;
82768
d6d732ef5650562f1f1593df4bd446614e3f2dfa Bug 708735 - Use <stdint.h> types in JSAPI and throughout SpiderMonkey. Continue to provide the {u,}int{8,16,32,64} and JS{Uint,Int}{8,16,32,64} integer types through a single header, however, for a simpler backout strategy -- and also to ease the transition for embedders. r=timeless on switching the jsd API to use the <stdint.h> types, r=luke, r=dmandelin
Jeff Walden <jwalden@mit.edu>
parents: 80807
diff changeset
   908
        for (uint32_t k = 0; k < array_count; k++) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   909
            nsISupports* p = pp[k];
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   910
            NS_IF_RELEASE(p);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   911
        }
78744
25a5c9891392c72ac42f2771176d3f0d803ae890 Bug 688012 - Hoist 'else' clauses to the line of the previous close-curly-brace. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78743
diff changeset
   912
    } else {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   913
        void** pp = (void**) arrayp;
82768
d6d732ef5650562f1f1593df4bd446614e3f2dfa Bug 708735 - Use <stdint.h> types in JSAPI and throughout SpiderMonkey. Continue to provide the {u,}int{8,16,32,64} and JS{Uint,Int}{8,16,32,64} integer types through a single header, however, for a simpler backout strategy -- and also to ease the transition for embedders. r=timeless on switching the jsd API to use the <stdint.h> types, r=luke, r=dmandelin
Jeff Walden <jwalden@mit.edu>
parents: 80807
diff changeset
   914
        for (uint32_t k = 0; k < array_count; k++) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   915
            void* p = pp[k];
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   916
            if (p) nsMemory::Free(p);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   917
        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   918
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   919
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   920
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   921
void
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   922
nsXPCWrappedJSClass::CleanupPointerTypeObject(const nsXPTType& type,
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   923
                                              void** pp)
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   924
{
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   925
    NS_ASSERTION(pp,"null pointer");
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   926
    if (type.IsInterfacePointer()) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   927
        nsISupports* p = *((nsISupports**)pp);
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   928
        if (p) p->Release();
78744
25a5c9891392c72ac42f2771176d3f0d803ae890 Bug 688012 - Hoist 'else' clauses to the line of the previous close-curly-brace. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78743
diff changeset
   929
    } else {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   930
        void* p = *((void**)pp);
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   931
        if (p) nsMemory::Free(p);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   932
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   933
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   934
20343
3aec0eec68a13bc51e3261c1edd1daf92f15df5c Bug 455436 - "XPConnect insists on using its own error reporter even when another is already set." r+sr=jst.
Ben Turner <bent.mozilla@gmail.com>
parents: 19673
diff changeset
   935
class AutoClearPendingException
3aec0eec68a13bc51e3261c1edd1daf92f15df5c Bug 455436 - "XPConnect insists on using its own error reporter even when another is already set." r+sr=jst.
Ben Turner <bent.mozilla@gmail.com>
parents: 19673
diff changeset
   936
{
3aec0eec68a13bc51e3261c1edd1daf92f15df5c Bug 455436 - "XPConnect insists on using its own error reporter even when another is already set." r+sr=jst.
Ben Turner <bent.mozilla@gmail.com>
parents: 19673
diff changeset
   937
public:
3aec0eec68a13bc51e3261c1edd1daf92f15df5c Bug 455436 - "XPConnect insists on using its own error reporter even when another is already set." r+sr=jst.
Ben Turner <bent.mozilla@gmail.com>
parents: 19673
diff changeset
   938
  AutoClearPendingException(JSContext *cx) : mCx(cx) { }
3aec0eec68a13bc51e3261c1edd1daf92f15df5c Bug 455436 - "XPConnect insists on using its own error reporter even when another is already set." r+sr=jst.
Ben Turner <bent.mozilla@gmail.com>
parents: 19673
diff changeset
   939
  ~AutoClearPendingException() { JS_ClearPendingException(mCx); }
3aec0eec68a13bc51e3261c1edd1daf92f15df5c Bug 455436 - "XPConnect insists on using its own error reporter even when another is already set." r+sr=jst.
Ben Turner <bent.mozilla@gmail.com>
parents: 19673
diff changeset
   940
private:
3aec0eec68a13bc51e3261c1edd1daf92f15df5c Bug 455436 - "XPConnect insists on using its own error reporter even when another is already set." r+sr=jst.
Ben Turner <bent.mozilla@gmail.com>
parents: 19673
diff changeset
   941
  JSContext* mCx;
3aec0eec68a13bc51e3261c1edd1daf92f15df5c Bug 455436 - "XPConnect insists on using its own error reporter even when another is already set." r+sr=jst.
Ben Turner <bent.mozilla@gmail.com>
parents: 19673
diff changeset
   942
};
3aec0eec68a13bc51e3261c1edd1daf92f15df5c Bug 455436 - "XPConnect insists on using its own error reporter even when another is already set." r+sr=jst.
Ben Turner <bent.mozilla@gmail.com>
parents: 19673
diff changeset
   943
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   944
nsresult
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   945
nsXPCWrappedJSClass::CheckForException(XPCCallContext & ccx,
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   946
                                       const char * aPropertyName,
14170
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
   947
                                       const char * anInterfaceName,
77799
e7854b4d29ba905ae3994f821b160c989bac4260 Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
Michael Wu <mwu@mozilla.com>
parents: 77538
diff changeset
   948
                                       bool aForceReport)
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   949
{
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   950
    XPCContext * xpcc = ccx.GetXPCContext();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   951
    JSContext * cx = ccx.GetJSContext();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   952
    nsCOMPtr<nsIException> xpc_exception;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   953
    /* this one would be set by our error reporter */
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   954
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   955
    xpcc->GetException(getter_AddRefs(xpc_exception));
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   956
    if (xpc_exception)
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   957
        xpcc->SetException(nullptr);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   958
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   959
    // get this right away in case we do something below to cause JS code
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   960
    // to run on this JSContext
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   961
    nsresult pending_result = xpcc->GetPendingResult();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   962
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   963
    jsval js_exception;
20343
3aec0eec68a13bc51e3261c1edd1daf92f15df5c Bug 455436 - "XPConnect insists on using its own error reporter even when another is already set." r+sr=jst.
Ben Turner <bent.mozilla@gmail.com>
parents: 19673
diff changeset
   964
    JSBool is_js_exception = JS_GetPendingException(cx, &js_exception);
3aec0eec68a13bc51e3261c1edd1daf92f15df5c Bug 455436 - "XPConnect insists on using its own error reporter even when another is already set." r+sr=jst.
Ben Turner <bent.mozilla@gmail.com>
parents: 19673
diff changeset
   965
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   966
    /* JS might throw an expection whether the reporter was called or not */
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   967
    if (is_js_exception) {
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   968
        if (!xpc_exception)
134048
9ab08f6d22582cc760e8dabf55da730556a7a0d0 Bug 877261 - Stop using XPCCallContext for XPCConvert. r=Ms2ger
Bobby Holley <bobbyholley@gmail.com>
parents: 133709
diff changeset
   969
            XPCConvert::JSValToXPCException(js_exception, anInterfaceName,
14170
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
   970
                                            aPropertyName,
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
   971
                                            getter_AddRefs(xpc_exception));
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   972
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   973
        /* cleanup and set failed even if we can't build an exception */
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   974
        if (!xpc_exception) {
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
   975
            XPCJSRuntime::Get()->SetPendingException(nullptr); // XXX necessary?
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   976
        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   977
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   978
20343
3aec0eec68a13bc51e3261c1edd1daf92f15df5c Bug 455436 - "XPConnect insists on using its own error reporter even when another is already set." r+sr=jst.
Ben Turner <bent.mozilla@gmail.com>
parents: 19673
diff changeset
   979
    AutoClearPendingException acpe(cx);
3aec0eec68a13bc51e3261c1edd1daf92f15df5c Bug 455436 - "XPConnect insists on using its own error reporter even when another is already set." r+sr=jst.
Ben Turner <bent.mozilla@gmail.com>
parents: 19673
diff changeset
   980
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   981
    if (xpc_exception) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
   982
        nsresult e_result;
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   983
        if (NS_SUCCEEDED(xpc_exception->GetResult(&e_result))) {
14170
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
   984
            // Figure out whether or not we should report this exception.
77799
e7854b4d29ba905ae3994f821b160c989bac4260 Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
Michael Wu <mwu@mozilla.com>
parents: 77538
diff changeset
   985
            bool reportable = xpc_IsReportableErrorCode(e_result);
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
   986
            if (reportable) {
14170
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
   987
                // Always want to report forced exceptions and XPConnect's own
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
   988
                // errors.
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
   989
                reportable = aForceReport ||
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
   990
                    NS_ERROR_GET_MODULE(e_result) == NS_ERROR_MODULE_XPCONNECT;
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
   991
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
   992
                // See if an environment variable was set or someone has told us
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
   993
                // that a user pref was set indicating that we should report all
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
   994
                // exceptions.
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
   995
                if (!reportable)
14170
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
   996
                    reportable = nsXPConnect::ReportAllJSExceptions();
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
   997
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
   998
                // Finally, check to see if this is the last JS frame on the
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
   999
                // stack. If so then we always want to report it.
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1000
                if (!reportable) {
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1001
                    reportable = !JS_DescribeScriptedCaller(cx, nullptr, nullptr);
14170
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
  1002
                }
78739
014c9cf5088f1af09d9d3969771c9ef857b3dd78 Bug 688012 - Remove trailing whitespace within XPConnect. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78738
diff changeset
  1003
14170
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
  1004
                // Ugly special case for GetInterface. It's "special" in the
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
  1005
                // same way as QueryInterface in that a failure is not
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
  1006
                // exceptional and shouldn't be reported. We have to do this
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
  1007
                // check here instead of in xpcwrappedjs (like we do for QI) to
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
  1008
                // avoid adding extra code to all xpcwrappedjs objects.
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1009
                if (reportable && e_result == NS_ERROR_NO_INTERFACE &&
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1010
                    !strcmp(anInterfaceName, "nsIInterfaceRequestor") &&
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1011
                    !strcmp(aPropertyName, "getInterface")) {
78840
ec7577dec4fceef0ac2717416d9c48289402d935 Bug 690892 - Replace PR_TRUE/PR_FALSE with true/false on mozilla-central; rs=dbaron
Ehsan Akhgari <ehsan@mozilla.com>
parents: 78745
diff changeset
  1012
                    reportable = false;
14170
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
  1013
                }
134633
d8425335f52f560ae2858f8c76e389084d06efe8 Bug 877760 - XPConnect always logs an error when a component doesn't implement a method. r=mrbkap
Gabor Krizsanits <gkrizsanits@mozilla.com>
parents: 134052
diff changeset
  1014
d8425335f52f560ae2858f8c76e389084d06efe8 Bug 877760 - XPConnect always logs an error when a component doesn't implement a method. r=mrbkap
Gabor Krizsanits <gkrizsanits@mozilla.com>
parents: 134052
diff changeset
  1015
                // More special case, see bug 877760.
d8425335f52f560ae2858f8c76e389084d06efe8 Bug 877760 - XPConnect always logs an error when a component doesn't implement a method. r=mrbkap
Gabor Krizsanits <gkrizsanits@mozilla.com>
parents: 134052
diff changeset
  1016
                if (e_result == NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED) {
d8425335f52f560ae2858f8c76e389084d06efe8 Bug 877760 - XPConnect always logs an error when a component doesn't implement a method. r=mrbkap
Gabor Krizsanits <gkrizsanits@mozilla.com>
parents: 134052
diff changeset
  1017
                    reportable = false;
d8425335f52f560ae2858f8c76e389084d06efe8 Bug 877760 - XPConnect always logs an error when a component doesn't implement a method. r=mrbkap
Gabor Krizsanits <gkrizsanits@mozilla.com>
parents: 134052
diff changeset
  1018
                }
14170
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
  1019
            }
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
  1020
20343
3aec0eec68a13bc51e3261c1edd1daf92f15df5c Bug 455436 - "XPConnect insists on using its own error reporter even when another is already set." r+sr=jst.
Ben Turner <bent.mozilla@gmail.com>
parents: 19673
diff changeset
  1021
            // Try to use the error reporter set on the context to handle this
3aec0eec68a13bc51e3261c1edd1daf92f15df5c Bug 455436 - "XPConnect insists on using its own error reporter even when another is already set." r+sr=jst.
Ben Turner <bent.mozilla@gmail.com>
parents: 19673
diff changeset
  1022
            // error if it came from a JS exception.
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1023
            if (reportable && is_js_exception &&
84461
f9fe45249420b8b0b0d216cc57e40498f866b726 Bug 677079 - Part i: Expose errorReporter in jsapi.h; r=mrbkap
Ms2ger <ms2ger@gmail.com>
parents: 84175
diff changeset
  1024
                JS_GetErrorReporter(cx) != xpcWrappedJSErrorReporter) {
20343
3aec0eec68a13bc51e3261c1edd1daf92f15df5c Bug 455436 - "XPConnect insists on using its own error reporter even when another is already set." r+sr=jst.
Ben Turner <bent.mozilla@gmail.com>
parents: 19673
diff changeset
  1025
                reportable = !JS_ReportPendingException(cx);
3aec0eec68a13bc51e3261c1edd1daf92f15df5c Bug 455436 - "XPConnect insists on using its own error reporter even when another is already set." r+sr=jst.
Ben Turner <bent.mozilla@gmail.com>
parents: 19673
diff changeset
  1026
            }
3aec0eec68a13bc51e3261c1edd1daf92f15df5c Bug 455436 - "XPConnect insists on using its own error reporter even when another is already set." r+sr=jst.
Ben Turner <bent.mozilla@gmail.com>
parents: 19673
diff changeset
  1027
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1028
            if (reportable) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1029
#ifdef DEBUG
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1030
                static const char line[] =
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1031
                    "************************************************************\n";
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1032
                static const char preamble[] =
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1033
                    "* Call to xpconnect wrapped JSObject produced this error:  *\n";
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1034
                static const char cant_get_text[] =
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1035
                    "FAILED TO GET TEXT FROM EXCEPTION\n";
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1036
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1037
                fputs(line, stdout);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1038
                fputs(preamble, stdout);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1039
                char* text;
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1040
                if (NS_SUCCEEDED(xpc_exception->ToString(&text)) && text) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1041
                    fputs(text, stdout);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1042
                    fputs("\n", stdout);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1043
                    nsMemory::Free(text);
78744
25a5c9891392c72ac42f2771176d3f0d803ae890 Bug 688012 - Hoist 'else' clauses to the line of the previous close-curly-brace. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78743
diff changeset
  1044
                } else
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1045
                    fputs(cant_get_text, stdout);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1046
                fputs(line, stdout);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1047
#endif
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1048
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1049
                // Log the exception to the JS Console, so that users can do
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1050
                // something with it.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1051
                nsCOMPtr<nsIConsoleService> consoleService
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1052
                    (do_GetService(XPC_CONSOLE_CONTRACTID));
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1053
                if (nullptr != consoleService) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1054
                    nsresult rv;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1055
                    nsCOMPtr<nsIScriptError> scriptError;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1056
                    nsCOMPtr<nsISupports> errorData;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1057
                    rv = xpc_exception->GetData(getter_AddRefs(errorData));
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1058
                    if (NS_SUCCEEDED(rv))
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1059
                        scriptError = do_QueryInterface(errorData);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1060
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1061
                    if (nullptr == scriptError) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1062
                        // No luck getting one from the exception, so
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1063
                        // try to cook one up.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1064
                        scriptError = do_CreateInstance(XPC_SCRIPT_ERROR_CONTRACTID);
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1065
                        if (nullptr != scriptError) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1066
                            char* exn_string;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1067
                            rv = xpc_exception->ToString(&exn_string);
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1068
                            if (NS_SUCCEEDED(rv)) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1069
                                // use toString on the exception as the message
90287
28cc6bf92f1f23b304f7617be2d33bf71a65040a Bug 716333 - get rid of WithConversion (xpconnect part). r=bholley
Makoto Kato <m_kato@ga2.so-net.ne.jp>
parents: 88562
diff changeset
  1070
                                NS_ConvertASCIItoUTF16 newMessage(exn_string);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1071
                                nsMemory::Free((void *) exn_string);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1072
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1073
                                // try to get filename, lineno from the first
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1074
                                // stack frame location.
102997
a16372ce30b5f6b747246b01fcd215a4bf3b6342 Bug 579517 - Part 1: Automated conversion of NSPR numeric types to stdint types in Gecko; r=bsmedberg
Ehsan Akhgari <ehsan@mozilla.com>
parents: 100875
diff changeset
  1075
                                int32_t lineNumber = 0;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1076
                                nsXPIDLCString sourceName;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1077
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1078
                                nsCOMPtr<nsIStackFrame> location;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1079
                                xpc_exception->
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1080
                                    GetLocation(getter_AddRefs(location));
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1081
                                if (location) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1082
                                    // Get line number w/o checking; 0 is ok.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1083
                                    location->GetLineNumber(&lineNumber);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1084
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1085
                                    // get a filename.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1086
                                    rv = location->GetFilename(getter_Copies(sourceName));
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1087
                                }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1088
104686
70a0eda09c3cd2bdc33f9d91d62a0c8a079b04a9 Bug 789382: Change nsIScriptError methods init() and initWithWindowID() to take nsAString, rather than wchar / PRUnichar*. r=bz sr=bsmedberg
Daniel Holbert <dholbert@cs.stanford.edu>
parents: 104460
diff changeset
  1089
                                rv = scriptError->InitWithWindowID(newMessage,
70a0eda09c3cd2bdc33f9d91d62a0c8a079b04a9 Bug 789382: Change nsIScriptError methods init() and initWithWindowID() to take nsAString, rather than wchar / PRUnichar*. r=bz sr=bsmedberg
Daniel Holbert <dholbert@cs.stanford.edu>
parents: 104460
diff changeset
  1090
                                                                   NS_ConvertASCIItoUTF16(sourceName),
70a0eda09c3cd2bdc33f9d91d62a0c8a079b04a9 Bug 789382: Change nsIScriptError methods init() and initWithWindowID() to take nsAString, rather than wchar / PRUnichar*. r=bz sr=bsmedberg
Daniel Holbert <dholbert@cs.stanford.edu>
parents: 104460
diff changeset
  1091
                                                                   EmptyString(),
83211
916876a3db976b54c3ea5b28162b06fceeb21b0a Bug 711721 - merge nsIScriptError and nsIScriptError2 interfaces; r=neil, sr=bzbarsky
aceman <acelists@atlas.sk>
parents: 82768
diff changeset
  1092
                                                                   lineNumber, 0, 0,
916876a3db976b54c3ea5b28162b06fceeb21b0a Bug 711721 - merge nsIScriptError and nsIScriptError2 interfaces; r=neil, sr=bzbarsky
aceman <acelists@atlas.sk>
parents: 82768
diff changeset
  1093
                                                                   "XPConnect JavaScript",
916876a3db976b54c3ea5b28162b06fceeb21b0a Bug 711721 - merge nsIScriptError and nsIScriptError2 interfaces; r=neil, sr=bzbarsky
aceman <acelists@atlas.sk>
parents: 82768
diff changeset
  1094
                                                                   nsJSUtils::GetCurrentlyRunningCodeInnerWindowID(cx));
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1095
                                if (NS_FAILED(rv))
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1096
                                    scriptError = nullptr;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1097
                            }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1098
                        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1099
                    }
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1100
                    if (nullptr != scriptError)
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1101
                        consoleService->LogMessage(scriptError);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1102
                }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1103
            }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1104
            // Whether or not it passes the 'reportable' test, it might
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1105
            // still be an error and we have to do the right thing here...
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1106
            if (NS_FAILED(e_result)) {
97272
77f929c7118c841c22e898c746ad84dbaa81f633 Bug 755255 - Hoist pending exception junk into XPCJSRuntime. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 97269
diff changeset
  1107
                XPCJSRuntime::Get()->SetPendingException(xpc_exception);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1108
                return e_result;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1109
            }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1110
        }
78744
25a5c9891392c72ac42f2771176d3f0d803ae890 Bug 688012 - Hoist 'else' clauses to the line of the previous close-curly-brace. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78743
diff changeset
  1111
    } else {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1112
        // see if JS code signaled failure result without throwing exception
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1113
        if (NS_FAILED(pending_result)) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1114
            return pending_result;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1115
        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1116
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1117
    return NS_ERROR_FAILURE;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1118
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1119
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1120
NS_IMETHODIMP
83645
69fe2af4da71132bc31b8866e1bb9e96a1f97a21 Bug 714057 - Remove uintn users from XPConnect; r=bholley+khuey
Ms2ger <ms2ger@gmail.com>
parents: 83298
diff changeset
  1121
nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16_t methodIndex,
113398
bbe72fef7e0fa9ef9e1c955fdc7ef916abfabfe4 Bug 809674 - Fail at call time when invoking an XPCWrappedJS method with [implicit_jscontext] or [optional_argc]. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 113081
diff changeset
  1122
                                const XPTMethodDescriptor* info_,
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1123
                                nsXPTCMiniVariant* nativeParams)
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1124
{
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1125
    jsval* sp = nullptr;
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1126
    jsval* argv = nullptr;
83645
69fe2af4da71132bc31b8866e1bb9e96a1f97a21 Bug 714057 - Remove uintn users from XPConnect; r=bholley+khuey
Ms2ger <ms2ger@gmail.com>
parents: 83298
diff changeset
  1127
    uint8_t i;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1128
    nsresult retval = NS_ERROR_FAILURE;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1129
    nsresult pending_result = NS_OK;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1130
    JSBool success;
80807
3258ba3a269d5e865b720c853120e088d4537e10 Bug 701467 - Remove JS_TRUE/JS_FALSE from xpconnect; r=bholley
Ms2ger <ms2ger@gmail.com>
parents: 80787
diff changeset
  1131
    JSBool readyToDoTheCall = false;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1132
    nsID  param_iid;
113398
bbe72fef7e0fa9ef9e1c955fdc7ef916abfabfe4 Bug 809674 - Fail at call time when invoking an XPCWrappedJS method with [implicit_jscontext] or [optional_argc]. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 113081
diff changeset
  1133
    const nsXPTMethodInfo* info = static_cast<const nsXPTMethodInfo*>(info_);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1134
    const char* name = info->name;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1135
    JSBool foundDependentParam;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1136
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1137
    // Make sure not to set the callee on ccx until after we've gone through
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1138
    // the whole nsIXPCFunctionThisTranslator bit.  That code uses ccx to
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1139
    // convert natives to JSObjects, but we do NOT plan to pass those JSObjects
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1140
    // to our real callee.
130100
e90cc4d3501ad757ef077c57307fb9b05591c1ac Bug 865308: GC: More rooting work in XPConnect r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 129733
diff changeset
  1141
    JSContext *context = GetContextFromObjectOrDefault(wrapper);
10291
626d450f525188920f599039520a90492585997c Bug 352791 - "Permission denied to get property XULElement.ownerDocument". Patch by Blake Kaplan <mrbkap@gmail.com>. r=jst,bzbarsky. sr=brendan. a=blocking1.9.
bent.mozilla@gmail.com
parents: 9633
diff changeset
  1142
    XPCCallContext ccx(NATIVE_CALLER, context);
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1143
    if (!ccx.IsValid())
64116
9f3bde4148003592895a2e4dbabf35b0f6566889 Bug 602514 [@ AutoGCRooter::AutoGCRooter] if !ccx.IsValid() in nsXPCWrappedJSClass::CallMethod
timeless@mozdev.org
parents: 62405
diff changeset
  1144
        return retval;
9f3bde4148003592895a2e4dbabf35b0f6566889 Bug 602514 [@ AutoGCRooter::AutoGCRooter] if !ccx.IsValid() in nsXPCWrappedJSClass::CallMethod
timeless@mozdev.org
parents: 62405
diff changeset
  1145
84476
4b70a75df702f70bede9cf47005a4ed2039c5391 Bug 677079 - Part x: Move AutoValueVector to jsapi.h; r=evilpie
Ms2ger <ms2ger@gmail.com>
parents: 84461
diff changeset
  1146
    XPCContext *xpcc = ccx.GetXPCContext();
93084
2e603a571520b052866a1b55cddb51815a93f642 Bug 730208 - UnmarkGray fixups for globals and contexts. r=billm
Steve Fink <sfink@mozilla.com>
parents: 92396
diff changeset
  1147
    JSContext *cx = xpc_UnmarkGrayContext(ccx.GetJSContext());
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1148
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1149
    if (!cx || !xpcc || !IsReflectable(methodIndex))
62405
02be97f9ef0dd3dc13f3eaeb982bc82fedbab608 Bug 627954, part 2: ensure nsXPCConvert::VariantData2JS et al are in the correct compartment (r=mrbkap)
Luke Wagner <lw@mozilla.com>
parents: 62397
diff changeset
  1150
        return NS_ERROR_FAILURE;
02be97f9ef0dd3dc13f3eaeb982bc82fedbab608 Bug 627954, part 2: ensure nsXPCConvert::VariantData2JS et al are in the correct compartment (r=mrbkap)
Luke Wagner <lw@mozilla.com>
parents: 62397
diff changeset
  1151
113398
bbe72fef7e0fa9ef9e1c955fdc7ef916abfabfe4 Bug 809674 - Fail at call time when invoking an XPCWrappedJS method with [implicit_jscontext] or [optional_argc]. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 113081
diff changeset
  1152
    // [implicit_jscontext] and [optional_argc] have a different calling
bbe72fef7e0fa9ef9e1c955fdc7ef916abfabfe4 Bug 809674 - Fail at call time when invoking an XPCWrappedJS method with [implicit_jscontext] or [optional_argc]. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 113081
diff changeset
  1153
    // convention, which we don't support for JS-implemented components.
bbe72fef7e0fa9ef9e1c955fdc7ef916abfabfe4 Bug 809674 - Fail at call time when invoking an XPCWrappedJS method with [implicit_jscontext] or [optional_argc]. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 113081
diff changeset
  1154
    if (info->WantsOptArgc() || info->WantsContext()) {
bbe72fef7e0fa9ef9e1c955fdc7ef916abfabfe4 Bug 809674 - Fail at call time when invoking an XPCWrappedJS method with [implicit_jscontext] or [optional_argc]. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 113081
diff changeset
  1155
        const char *str = "IDL methods marked with [implicit_jscontext] "
bbe72fef7e0fa9ef9e1c955fdc7ef916abfabfe4 Bug 809674 - Fail at call time when invoking an XPCWrappedJS method with [implicit_jscontext] or [optional_argc]. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 113081
diff changeset
  1156
                          "or [optional_argc] may not be implemented in JS";
bbe72fef7e0fa9ef9e1c955fdc7ef916abfabfe4 Bug 809674 - Fail at call time when invoking an XPCWrappedJS method with [implicit_jscontext] or [optional_argc]. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 113081
diff changeset
  1157
        // Throw and warn for good measure.
bbe72fef7e0fa9ef9e1c955fdc7ef916abfabfe4 Bug 809674 - Fail at call time when invoking an XPCWrappedJS method with [implicit_jscontext] or [optional_argc]. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 113081
diff changeset
  1158
        JS_ReportError(cx, str);
bbe72fef7e0fa9ef9e1c955fdc7ef916abfabfe4 Bug 809674 - Fail at call time when invoking an XPCWrappedJS method with [implicit_jscontext] or [optional_argc]. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 113081
diff changeset
  1159
        NS_WARNING(str);
bbe72fef7e0fa9ef9e1c955fdc7ef916abfabfe4 Bug 809674 - Fail at call time when invoking an XPCWrappedJS method with [implicit_jscontext] or [optional_argc]. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 113081
diff changeset
  1160
        return NS_ERROR_FAILURE;
bbe72fef7e0fa9ef9e1c955fdc7ef916abfabfe4 Bug 809674 - Fail at call time when invoking an XPCWrappedJS method with [implicit_jscontext] or [optional_argc]. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 113081
diff changeset
  1161
    }
bbe72fef7e0fa9ef9e1c955fdc7ef916abfabfe4 Bug 809674 - Fail at call time when invoking an XPCWrappedJS method with [implicit_jscontext] or [optional_argc]. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 113081
diff changeset
  1162
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
  1163
    RootedValue fval(cx);
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
  1164
    RootedObject obj(cx, wrapper->GetJSObject());
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
  1165
    RootedObject thisObj(cx, obj);
62405
02be97f9ef0dd3dc13f3eaeb982bc82fedbab608 Bug 627954, part 2: ensure nsXPCConvert::VariantData2JS et al are in the correct compartment (r=mrbkap)
Luke Wagner <lw@mozilla.com>
parents: 62397
diff changeset
  1166
103263
0d61ae018d9f97407a37e327ee526fb018619f62 Bug 625199 - s/JSAutoEnterCompartment/JSAutoCompartment/ and make it infallible (r=bholley)
Luke Wagner <luke@mozilla.com>
parents: 102997
diff changeset
  1167
    JSAutoCompartment ac(cx, obj);
62405
02be97f9ef0dd3dc13f3eaeb982bc82fedbab608 Bug 627954, part 2: ensure nsXPCConvert::VariantData2JS et al are in the correct compartment (r=mrbkap)
Luke Wagner <lw@mozilla.com>
parents: 62397
diff changeset
  1168
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
  1169
    AutoValueVector args(cx);
61247
bee0e6e72ca50dedbe19f284e8149fb03f2f2d42 Backed out changeset e13f3b909fa2
Steve Fink <sfink@mozilla.com>
parents: 61234
diff changeset
  1170
    AutoScriptEvaluate scriptEval(cx);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1171
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1172
    // XXX ASSUMES that retval is last arg. The xpidl compiler ensures this.
84476
4b70a75df702f70bede9cf47005a4ed2039c5391 Bug 677079 - Part x: Move AutoValueVector to jsapi.h; r=evilpie
Ms2ger <ms2ger@gmail.com>
parents: 84461
diff changeset
  1173
    uint8_t paramCount = info->num_args;
4b70a75df702f70bede9cf47005a4ed2039c5391 Bug 677079 - Part x: Move AutoValueVector to jsapi.h; r=evilpie
Ms2ger <ms2ger@gmail.com>
parents: 84461
diff changeset
  1174
    uint8_t argc = paramCount -
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1175
        (paramCount && XPT_PD_IS_RETVAL(info->params[paramCount-1].flags) ? 1 : 0);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1176
61765
96570116d62a16fb7a04ba6fb6d694137f0dda1a Enter compartment in AutoScriptEvaluate (bug 630243, r=jst, a=blocker).
Andreas Gal <gal@mozilla.com>
parents: 61451
diff changeset
  1177
    if (!scriptEval.StartEvaluating(obj, xpcWrappedJSErrorReporter))
96570116d62a16fb7a04ba6fb6d694137f0dda1a Enter compartment in AutoScriptEvaluate (bug 630243, r=jst, a=blocker).
Andreas Gal <gal@mozilla.com>
parents: 61451
diff changeset
  1178
        goto pre_call_clean_up;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1179
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1180
    xpcc->SetPendingResult(pending_result);
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1181
    xpcc->SetException(nullptr);
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1182
    XPCJSRuntime::Get()->SetPendingException(nullptr);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1183
42714
a000781786980e4dce0776300a78755a2af3db67 Bug 540706 - use contiguous buffer for stack frames and slots (r=waldo)
Luke Wagner <lw@mozilla.com>
parents: 42709
diff changeset
  1184
    // We use js_Invoke so that the gcthings we use as args will be rooted by
a000781786980e4dce0776300a78755a2af3db67 Bug 540706 - use contiguous buffer for stack frames and slots (r=waldo)
Luke Wagner <lw@mozilla.com>
parents: 42709
diff changeset
  1185
    // the engine as we do conversions and prepare to do the function call.
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1186
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1187
    // setup stack
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1188
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1189
    // if this isn't a function call then we don't need to push extra stuff
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1190
    if (!(XPT_MD_IS_SETTER(info->flags) || XPT_MD_IS_GETTER(info->flags))) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1191
        // We get fval before allocating the stack to avoid gc badness that can
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1192
        // happen if the GetProperty call leaves our request and the gc runs
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1193
        // while the stack we allocate contains garbage.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1194
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1195
        // If the interface is marked as a [function] then we will assume that
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1196
        // our JSObject is a function and not an object with a named method.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1197
77799
e7854b4d29ba905ae3994f821b160c989bac4260 Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
Michael Wu <mwu@mozilla.com>
parents: 77538
diff changeset
  1198
        bool isFunction;
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1199
        if (NS_FAILED(mInfo->IsFunction(&isFunction)))
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1200
            goto pre_call_clean_up;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1201
78739
014c9cf5088f1af09d9d3969771c9ef857b3dd78 Bug 688012 - Remove trailing whitespace within XPConnect. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78738
diff changeset
  1202
        // In the xpidl [function] case we are making sure now that the
014c9cf5088f1af09d9d3969771c9ef857b3dd78 Bug 688012 - Remove trailing whitespace within XPConnect. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78738
diff changeset
  1203
        // JSObject is callable. If it is *not* callable then we silently
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1204
        // fallback to looking up the named property...
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1205
        // (because jst says he thinks this fallback is 'The Right Thing'.)
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1206
        //
78739
014c9cf5088f1af09d9d3969771c9ef857b3dd78 Bug 688012 - Remove trailing whitespace within XPConnect. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78738
diff changeset
  1207
        // In the normal (non-function) case we just lookup the property by
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1208
        // name and as long as the object has such a named property we go ahead
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1209
        // and try to make the call. If it turns out the named property is not
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1210
        // a callable object then the JS engine will throw an error and we'll
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1211
        // pass this along to the caller as an exception/result code.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1212
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1213
        if (isFunction &&
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1214
            JS_TypeOfValue(ccx, OBJECT_TO_JSVAL(obj)) == JSTYPE_FUNCTION) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1215
            fval = OBJECT_TO_JSVAL(obj);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1216
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1217
            // We may need to translate the 'this' for the function object.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1218
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1219
            if (paramCount) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1220
                const nsXPTParamInfo& firstParam = info->params[0];
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1221
                if (firstParam.IsIn()) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1222
                    const nsXPTType& firstType = firstParam.GetType();
80786
42ab175e8d8108c825b18d304146ae3465e0ca61 Bug 692342 - Remove the obviously superfluous uses of IsPointer(). r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 80659
diff changeset
  1223
42ab175e8d8108c825b18d304146ae3465e0ca61 Bug 692342 - Remove the obviously superfluous uses of IsPointer(). r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 80659
diff changeset
  1224
                    if (firstType.IsInterfacePointer()) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1225
                        nsIXPCFunctionThisTranslator* translator;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1226
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1227
                        IID2ThisTranslatorMap* map =
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1228
                            mRuntime->GetThisTranslatorMap();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1229
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1230
                        {
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1231
                            XPCAutoLock lock(mRuntime->GetMapLock()); // scoped lock
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1232
                            translator = map->Find(mIID);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1233
                        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1234
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1235
                        if (translator) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1236
                            nsCOMPtr<nsISupports> newThis;
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1237
                            if (NS_FAILED(translator->
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1238
                                          TranslateThis((nsISupports*)nativeParams[0].val.p,
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1239
                                                        getter_AddRefs(newThis)))) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1240
                                goto pre_call_clean_up;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1241
                            }
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1242
                            if (newThis) {
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
  1243
                                RootedValue v(cx);
51515
bb8020341d712d4128703bbbeace9076c0bd2db4 Fix for bug 565742 (too much QIing/Addrefing/Releasing under NativeInterface2JSObject). r=smaug, a=bsmedberg.
Peter Van der Beken <peterv@propagandism.org>
parents: 50465
diff changeset
  1244
                                xpcObjectHelper helper(newThis);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1245
                                JSBool ok =
108810
2f03d52c71909cbf91b849134b0b8448f35c7506 Bug 780151 - Part a: Remove unused arguments to TranslateThis; r=bz
Ms2ger <ms2ger@gmail.com>
parents: 107626
diff changeset
  1246
                                  XPCConvert::NativeInterface2JSObject(
134048
9ab08f6d22582cc760e8dabf55da730556a7a0d0 Bug 877261 - Stop using XPCCallContext for XPCConvert. r=Ms2ger
Bobby Holley <bobbyholley@gmail.com>
parents: 133709
diff changeset
  1247
                                      v.address(), nullptr, helper, nullptr,
108810
2f03d52c71909cbf91b849134b0b8448f35c7506 Bug 780151 - Part a: Remove unused arguments to TranslateThis; r=bz
Ms2ger <ms2ger@gmail.com>
parents: 107626
diff changeset
  1248
                                      nullptr, false, nullptr);
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1249
                                if (!ok) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1250
                                    goto pre_call_clean_up;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1251
                                }
22841
3a64573e89376a8988de12a0ee3c7d6619d5ae92 Fix for bug 461563 (Allow WrapNative to return a jsval without the wrapper). r/sr=jst.
Peter Van der Beken <peterv@propagandism.org>
parents: 22475
diff changeset
  1252
                                thisObj = JSVAL_TO_OBJECT(v);
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
  1253
                                if (!JS_WrapObject(cx, thisObj.address()))
55946
bd3e354ddb1ade7fd584c51811497c046e744e92 Bug 604368 - Protect against the this translator returning a this object from another domain. r=peterv, a=blocking
Blake Kaplan <mrbkap@gmail.com>
parents: 55685
diff changeset
  1254
                                    goto pre_call_clean_up;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1255
                            }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1256
                        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1257
                    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1258
                }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1259
            }
130146
7f6765e6e3be80ec54f024c5259beeea262d2ede Bug 836949 - Remove the now unnecessary GetMethod function. r=jwalden
Tom Schuster <evilpies@gmail.com>
parents: 130100
diff changeset
  1260
        } else {
7f6765e6e3be80ec54f024c5259beeea262d2ede Bug 836949 - Remove the now unnecessary GetMethod function. r=jwalden
Tom Schuster <evilpies@gmail.com>
parents: 130100
diff changeset
  1261
            if (!JS_GetProperty(cx, obj, name, fval.address()))
7f6765e6e3be80ec54f024c5259beeea262d2ede Bug 836949 - Remove the now unnecessary GetMethod function. r=jwalden
Tom Schuster <evilpies@gmail.com>
parents: 130100
diff changeset
  1262
                goto pre_call_clean_up;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1263
            // XXX We really want to factor out the error reporting better and
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1264
            // specifically report the failure to find a function with this name.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1265
            // This is what we do below if the property is found but is not a
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1266
            // function. We just need to factor better so we can get to that
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1267
            // reporting path from here.
130146
7f6765e6e3be80ec54f024c5259beeea262d2ede Bug 836949 - Remove the now unnecessary GetMethod function. r=jwalden
Tom Schuster <evilpies@gmail.com>
parents: 130100
diff changeset
  1268
7f6765e6e3be80ec54f024c5259beeea262d2ede Bug 836949 - Remove the now unnecessary GetMethod function. r=jwalden
Tom Schuster <evilpies@gmail.com>
parents: 130100
diff changeset
  1269
            thisObj = obj;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1270
        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1271
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1272
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1273
    if (!args.resize(argc)) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1274
        retval = NS_ERROR_OUT_OF_MEMORY;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1275
        goto pre_call_clean_up;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1276
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1277
84476
4b70a75df702f70bede9cf47005a4ed2039c5391 Bug 677079 - Part x: Move AutoValueVector to jsapi.h; r=evilpie
Ms2ger <ms2ger@gmail.com>
parents: 84461
diff changeset
  1278
    argv = args.begin();
50465
c2411a6276fc54fd73c5c90edbfc838947c28934 Bug 579183 - loosen-up StackSegment invariants - part 2 - xpconnect (r=mrbkap)
Luke Wagner <lw@mozilla.com>
parents: 48503
diff changeset
  1279
    sp = argv;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1280
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1281
    // build the args
55604
c42a624a877c66721a8a4b827bae87be66740b0d bug 580128 - Avoid using the parent chain of proxies for anything because it's often wrong. r=jst
Blake Kaplan <mrbkap@gmail.com>
parents: 55601
diff changeset
  1282
    // NB: This assignment *looks* wrong because we haven't yet called our
c42a624a877c66721a8a4b827bae87be66740b0d bug 580128 - Avoid using the parent chain of proxies for anything because it's often wrong. r=jst
Blake Kaplan <mrbkap@gmail.com>
parents: 55601
diff changeset
  1283
    // function. However, we *have* already entered the compartmen that we're
c42a624a877c66721a8a4b827bae87be66740b0d bug 580128 - Avoid using the parent chain of proxies for anything because it's often wrong. r=jst
Blake Kaplan <mrbkap@gmail.com>
parents: 55601
diff changeset
  1284
    // about to call, and that's the global that we want here. In other words:
c42a624a877c66721a8a4b827bae87be66740b0d bug 580128 - Avoid using the parent chain of proxies for anything because it's often wrong. r=jst
Blake Kaplan <mrbkap@gmail.com>
parents: 55601
diff changeset
  1285
    // we're trusting the JS engine to come up with a good global to use for
c42a624a877c66721a8a4b827bae87be66740b0d bug 580128 - Avoid using the parent chain of proxies for anything because it's often wrong. r=jst
Blake Kaplan <mrbkap@gmail.com>
parents: 55601
diff changeset
  1286
    // our object (whatever it was).
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1287
    for (i = 0; i < argc; i++) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1288
        const nsXPTParamInfo& param = info->params[i];
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1289
        const nsXPTType& type = param.GetType();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1290
        nsXPTType datum_type;
82768
d6d732ef5650562f1f1593df4bd446614e3f2dfa Bug 708735 - Use <stdint.h> types in JSAPI and throughout SpiderMonkey. Continue to provide the {u,}int{8,16,32,64} and JS{Uint,Int}{8,16,32,64} integer types through a single header, however, for a simpler backout strategy -- and also to ease the transition for embedders. r=timeless on switching the jsd API to use the <stdint.h> types, r=luke, r=dmandelin
Jeff Walden <jwalden@mit.edu>
parents: 80807
diff changeset
  1291
        uint32_t array_count;
77799
e7854b4d29ba905ae3994f821b160c989bac4260 Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
Michael Wu <mwu@mozilla.com>
parents: 77538
diff changeset
  1292
        bool isArray = type.IsArray();
129733
233f42abf005885675622decfd19712ff71f957c Bug 861912 - GC: Remove use of AUTO_MARK_JSVAL in XPConnect r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 129732
diff changeset
  1293
        RootedValue val(cx, NullValue());
77799
e7854b4d29ba905ae3994f821b160c989bac4260 Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
Michael Wu <mwu@mozilla.com>
parents: 77538
diff changeset
  1294
        bool isSizedString = isArray ?
80807
3258ba3a269d5e865b720c853120e088d4537e10 Bug 701467 - Remove JS_TRUE/JS_FALSE from xpconnect; r=bholley
Ms2ger <ms2ger@gmail.com>
parents: 80787
diff changeset
  1295
                false :
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1296
                type.TagPart() == nsXPTType::T_PSTRING_SIZE_IS ||
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1297
                type.TagPart() == nsXPTType::T_PWSTRING_SIZE_IS;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1298
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1299
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1300
        // verify that null was not passed for 'out' param
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1301
        if (param.IsOut() && !nativeParams[i].val.p) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1302
            retval = NS_ERROR_INVALID_ARG;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1303
            goto pre_call_clean_up;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1304
        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1305
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1306
        if (isArray) {
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1307
            if (NS_FAILED(mInfo->GetTypeForParam(methodIndex, &param, 1,
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1308
                                                 &datum_type)))
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1309
                goto pre_call_clean_up;
78744
25a5c9891392c72ac42f2771176d3f0d803ae890 Bug 688012 - Hoist 'else' clauses to the line of the previous close-curly-brace. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78743
diff changeset
  1310
        } else
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1311
            datum_type = type;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1312
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1313
        if (param.IsIn()) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1314
            nsXPTCMiniVariant* pv;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1315
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1316
            if (param.IsIndirect())
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1317
                pv = (nsXPTCMiniVariant*) nativeParams[i].val.p;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1318
            else
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1319
                pv = &nativeParams[i];
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1320
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1321
            if (datum_type.IsInterfacePointer() &&
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1322
                !GetInterfaceTypeFromParam(cx, info, param, methodIndex,
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1323
                                           datum_type, nativeParams,
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1324
                                           &param_iid))
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1325
                goto pre_call_clean_up;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1326
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1327
            if (isArray || isSizedString) {
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1328
                if (!GetArraySizeFromParam(cx, info, param, methodIndex,
79867
104c466724acd2cb7e9d3b648d140f355510bb15 Bug 677788 - Remove use of length_is xpt value from gecko. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 79866
diff changeset
  1329
                                           i, nativeParams, &array_count))
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1330
                    goto pre_call_clean_up;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1331
            }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1332
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1333
            if (isArray) {
134048
9ab08f6d22582cc760e8dabf55da730556a7a0d0 Bug 877261 - Stop using XPCCallContext for XPCConvert. r=Ms2ger
Bobby Holley <bobbyholley@gmail.com>
parents: 133709
diff changeset
  1334
                if (!XPCConvert::NativeArray2JS(val.address(),
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1335
                                                (const void**)&pv->val,
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1336
                                                datum_type, &param_iid,
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1337
                                                array_count, nullptr))
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1338
                    goto pre_call_clean_up;
78744
25a5c9891392c72ac42f2771176d3f0d803ae890 Bug 688012 - Hoist 'else' clauses to the line of the previous close-curly-brace. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78743
diff changeset
  1339
            } else if (isSizedString) {
134048
9ab08f6d22582cc760e8dabf55da730556a7a0d0 Bug 877261 - Stop using XPCCallContext for XPCConvert. r=Ms2ger
Bobby Holley <bobbyholley@gmail.com>
parents: 133709
diff changeset
  1340
                if (!XPCConvert::NativeStringWithSize2JS(val.address(),
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1341
                                                         (const void*)&pv->val,
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1342
                                                         datum_type,
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1343
                                                         array_count, nullptr))
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1344
                    goto pre_call_clean_up;
78744
25a5c9891392c72ac42f2771176d3f0d803ae890 Bug 688012 - Hoist 'else' clauses to the line of the previous close-curly-brace. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78743
diff changeset
  1345
            } else {
134048
9ab08f6d22582cc760e8dabf55da730556a7a0d0 Bug 877261 - Stop using XPCCallContext for XPCConvert. r=Ms2ger
Bobby Holley <bobbyholley@gmail.com>
parents: 133709
diff changeset
  1346
                if (!XPCConvert::NativeData2JS(val.address(), &pv->val, type,
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1347
                                               &param_iid, nullptr))
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1348
                    goto pre_call_clean_up;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1349
            }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1350
        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1351
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1352
        if (param.IsOut() || param.IsDipper()) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1353
            // create an 'out' object
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
  1354
            RootedObject out_obj(cx, NewOutObject(cx, obj));
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1355
            if (!out_obj) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1356
                retval = NS_ERROR_OUT_OF_MEMORY;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1357
                goto pre_call_clean_up;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1358
            }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1359
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1360
            if (param.IsIn()) {
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1361
                if (!JS_SetPropertyById(cx, out_obj,
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1362
                                        mRuntime->GetStringID(XPCJSRuntime::IDX_VALUE),
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
  1363
                                        val.address())) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1364
                    goto pre_call_clean_up;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1365
                }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1366
            }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1367
            *sp++ = OBJECT_TO_JSVAL(out_obj);
78744
25a5c9891392c72ac42f2771176d3f0d803ae890 Bug 688012 - Hoist 'else' clauses to the line of the previous close-curly-brace. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78743
diff changeset
  1368
        } else
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1369
            *sp++ = val;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1370
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1371
80807
3258ba3a269d5e865b720c853120e088d4537e10 Bug 701467 - Remove JS_TRUE/JS_FALSE from xpconnect; r=bholley
Ms2ger <ms2ger@gmail.com>
parents: 80787
diff changeset
  1372
    readyToDoTheCall = true;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1373
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1374
pre_call_clean_up:
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1375
    // clean up any 'out' params handed in
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1376
    for (i = 0; i < paramCount; i++) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1377
        const nsXPTParamInfo& param = info->params[i];
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1378
        if (!param.IsOut())
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1379
            continue;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1380
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1381
        const nsXPTType& type = param.GetType();
80787
e8df70ae53e2b693d2a16b2bda022cbb7e7eef47 Bug 692342 - Introduce deprecated_IsPointer() to handle the cases that are too mucky to figure out right now. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 80786
diff changeset
  1382
        if (!type.deprecated_IsPointer())
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1383
            continue;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1384
        void* p;
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1385
        if (!(p = nativeParams[i].val.p))
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1386
            continue;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1387
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1388
        if (param.IsIn()) {
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1389
            if (type.IsArray()) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1390
                void** pp;
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1391
                if (nullptr != (pp = *((void***)p))) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1392
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1393
                    // we need to get the array length and iterate the items
82768
d6d732ef5650562f1f1593df4bd446614e3f2dfa Bug 708735 - Use <stdint.h> types in JSAPI and throughout SpiderMonkey. Continue to provide the {u,}int{8,16,32,64} and JS{Uint,Int}{8,16,32,64} integer types through a single header, however, for a simpler backout strategy -- and also to ease the transition for embedders. r=timeless on switching the jsd API to use the <stdint.h> types, r=luke, r=dmandelin
Jeff Walden <jwalden@mit.edu>
parents: 80807
diff changeset
  1394
                    uint32_t array_count;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1395
                    nsXPTType datum_type;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1396
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1397
                    if (NS_SUCCEEDED(mInfo->GetTypeForParam(methodIndex, &param,
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1398
                                                            1, &datum_type)) &&
80787
e8df70ae53e2b693d2a16b2bda022cbb7e7eef47 Bug 692342 - Introduce deprecated_IsPointer() to handle the cases that are too mucky to figure out right now. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 80786
diff changeset
  1399
                        datum_type.deprecated_IsPointer() &&
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1400
                        GetArraySizeFromParam(cx, info, param, methodIndex,
79867
104c466724acd2cb7e9d3b648d140f355510bb15 Bug 677788 - Remove use of length_is xpt value from gecko. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 79866
diff changeset
  1401
                                              i, nativeParams, &array_count) &&
104c466724acd2cb7e9d3b648d140f355510bb15 Bug 677788 - Remove use of length_is xpt value from gecko. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 79866
diff changeset
  1402
                        array_count) {
104c466724acd2cb7e9d3b648d140f355510bb15 Bug 677788 - Remove use of length_is xpt value from gecko. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 79866
diff changeset
  1403
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1404
                        CleanupPointerArray(datum_type, array_count, pp);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1405
                    }
79867
104c466724acd2cb7e9d3b648d140f355510bb15 Bug 677788 - Remove use of length_is xpt value from gecko. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 79866
diff changeset
  1406
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1407
                    // always release the array if it is inout
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1408
                    nsMemory::Free(pp);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1409
                }
78744
25a5c9891392c72ac42f2771176d3f0d803ae890 Bug 688012 - Hoist 'else' clauses to the line of the previous close-curly-brace. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78743
diff changeset
  1410
            } else
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1411
                CleanupPointerTypeObject(type, (void**)p);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1412
        }
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1413
        *((void**)p) = nullptr;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1414
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1415
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1416
    // Make sure "this" doesn't get deleted during this call.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1417
    nsCOMPtr<nsIXPCWrappedJSClass> kungFuDeathGrip(this);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1418
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1419
    if (!readyToDoTheCall)
42714
a000781786980e4dce0776300a78755a2af3db67 Bug 540706 - use contiguous buffer for stack frames and slots (r=waldo)
Luke Wagner <lw@mozilla.com>
parents: 42709
diff changeset
  1420
        return retval;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1421
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1422
    // do the deed - note exceptions
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1423
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1424
    JS_ClearPendingException(cx);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1425
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
  1426
    RootedValue rval(cx);
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1427
    if (XPT_MD_IS_GETTER(info->flags)) {
129732
dff116662296a26dfdd9ac2ef49f7476ad85d899 Bug 864748 - Avoid accessing uninitialized data when calling a getter r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 129585
diff changeset
  1428
        success = JS_GetProperty(cx, obj, name, rval.address());
78744
25a5c9891392c72ac42f2771176d3f0d803ae890 Bug 688012 - Hoist 'else' clauses to the line of the previous close-curly-brace. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78743
diff changeset
  1429
    } else if (XPT_MD_IS_SETTER(info->flags)) {
50465
c2411a6276fc54fd73c5c90edbfc838947c28934 Bug 579183 - loosen-up StackSegment invariants - part 2 - xpconnect (r=mrbkap)
Luke Wagner <lw@mozilla.com>
parents: 48503
diff changeset
  1430
        success = JS_SetProperty(cx, obj, name, argv);
c2411a6276fc54fd73c5c90edbfc838947c28934 Bug 579183 - loosen-up StackSegment invariants - part 2 - xpconnect (r=mrbkap)
Luke Wagner <lw@mozilla.com>
parents: 48503
diff changeset
  1431
        rval = *argv;
78744
25a5c9891392c72ac42f2771176d3f0d803ae890 Bug 688012 - Hoist 'else' clauses to the line of the previous close-curly-brace. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78743
diff changeset
  1432
    } else {
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1433
        if (!JSVAL_IS_PRIMITIVE(fval)) {
83645
69fe2af4da71132bc31b8866e1bb9e96a1f97a21 Bug 714057 - Remove uintn users from XPConnect; r=bholley+khuey
Ms2ger <ms2ger@gmail.com>
parents: 83298
diff changeset
  1434
            uint32_t oldOpts = JS_GetOptions(cx);
50465
c2411a6276fc54fd73c5c90edbfc838947c28934 Bug 579183 - loosen-up StackSegment invariants - part 2 - xpconnect (r=mrbkap)
Luke Wagner <lw@mozilla.com>
parents: 48503
diff changeset
  1435
            JS_SetOptions(cx, oldOpts | JSOPTION_DONT_REPORT_UNCAUGHT);
c2411a6276fc54fd73c5c90edbfc838947c28934 Bug 579183 - loosen-up StackSegment invariants - part 2 - xpconnect (r=mrbkap)
Luke Wagner <lw@mozilla.com>
parents: 48503
diff changeset
  1436
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
  1437
            success = JS_CallFunctionValue(cx, thisObj, fval, argc, argv, rval.address());
50465
c2411a6276fc54fd73c5c90edbfc838947c28934 Bug 579183 - loosen-up StackSegment invariants - part 2 - xpconnect (r=mrbkap)
Luke Wagner <lw@mozilla.com>
parents: 48503
diff changeset
  1438
c2411a6276fc54fd73c5c90edbfc838947c28934 Bug 579183 - loosen-up StackSegment invariants - part 2 - xpconnect (r=mrbkap)
Luke Wagner <lw@mozilla.com>
parents: 48503
diff changeset
  1439
            JS_SetOptions(cx, oldOpts);
78744
25a5c9891392c72ac42f2771176d3f0d803ae890 Bug 688012 - Hoist 'else' clauses to the line of the previous close-curly-brace. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78743
diff changeset
  1440
        } else {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1441
            // The property was not an object so can't be a function.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1442
            // Let's build and 'throw' an exception.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1443
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1444
            static const nsresult code =
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1445
                    NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1446
            static const char format[] = "%s \"%s\"";
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1447
            const char * msg;
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1448
            char* sz = nullptr;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1449
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1450
            if (nsXPCException::NameAndFormatForNSResult(code, nullptr, &msg) && msg)
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1451
                sz = JS_smprintf(format, msg, name);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1452
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1453
            nsCOMPtr<nsIException> e;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1454
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1455
            XPCConvert::ConstructException(code, sz, GetInterfaceName(), name,
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1456
                                           nullptr, getter_AddRefs(e), nullptr, nullptr);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1457
            xpcc->SetException(e);
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1458
            if (sz)
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1459
                JS_smprintf_free(sz);
80807
3258ba3a269d5e865b720c853120e088d4537e10 Bug 701467 - Remove JS_TRUE/JS_FALSE from xpconnect; r=bholley
Ms2ger <ms2ger@gmail.com>
parents: 80787
diff changeset
  1460
            success = false;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1461
        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1462
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1463
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1464
    if (!success) {
77799
e7854b4d29ba905ae3994f821b160c989bac4260 Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
Michael Wu <mwu@mozilla.com>
parents: 77538
diff changeset
  1465
        bool forceReport;
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1466
        if (NS_FAILED(mInfo->IsFunction(&forceReport)))
78840
ec7577dec4fceef0ac2717416d9c48289402d935 Bug 690892 - Replace PR_TRUE/PR_FALSE with true/false on mozilla-central; rs=dbaron
Ehsan Akhgari <ehsan@mozilla.com>
parents: 78745
diff changeset
  1467
            forceReport = false;
14170
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
  1468
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
  1469
        // May also want to check if we're moving from content->chrome and force
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
  1470
        // a report in that case.
eaaf9cc4e1d1aeee5cbcb4394619f0c6983e4e3c Bug 415498 - "Some errors not displayed in Error Console when using addEventListener". Tests by Sylvain Pasche <sylvain.pasche@gmail.com>. r+sr=jst, a=beltzner.
bent.mozilla@gmail.com
parents: 11973
diff changeset
  1471
42714
a000781786980e4dce0776300a78755a2af3db67 Bug 540706 - use contiguous buffer for stack frames and slots (r=waldo)
Luke Wagner <lw@mozilla.com>
parents: 42709
diff changeset
  1472
        return CheckForException(ccx, name, GetInterfaceName(), forceReport);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1473
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1474
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1475
    XPCJSRuntime::Get()->SetPendingException(nullptr); // XXX necessary?
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1476
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1477
    // convert out args and result
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1478
    // NOTE: this is the total number of native params, not just the args
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1479
    // Convert independent params only.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1480
    // When we later convert the dependent params (if any) we will know that
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1481
    // the params upon which they depend will have already been converted -
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1482
    // regardless of ordering.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1483
80807
3258ba3a269d5e865b720c853120e088d4537e10 Bug 701467 - Remove JS_TRUE/JS_FALSE from xpconnect; r=bholley
Ms2ger <ms2ger@gmail.com>
parents: 80787
diff changeset
  1484
    foundDependentParam = false;
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1485
    for (i = 0; i < paramCount; i++) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1486
        const nsXPTParamInfo& param = info->params[i];
77535
04dc934f61d5b15d53af6f95a9f2430f21de0ed7 Bug 683802 - Eliminate questionable support for [shared] parameters. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 77532
diff changeset
  1487
        NS_ABORT_IF_FALSE(!param.IsShared(), "[shared] implies [noscript]!");
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1488
        if (!param.IsOut() && !param.IsDipper())
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1489
            continue;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1490
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1491
        const nsXPTType& type = param.GetType();
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1492
        if (type.IsDependent()) {
80807
3258ba3a269d5e865b720c853120e088d4537e10 Bug 701467 - Remove JS_TRUE/JS_FALSE from xpconnect; r=bholley
Ms2ger <ms2ger@gmail.com>
parents: 80787
diff changeset
  1493
            foundDependentParam = true;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1494
            continue;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1495
        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1496
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
  1497
        RootedValue val(cx);
83645
69fe2af4da71132bc31b8866e1bb9e96a1f97a21 Bug 714057 - Remove uintn users from XPConnect; r=bholley+khuey
Ms2ger <ms2ger@gmail.com>
parents: 83298
diff changeset
  1498
        uint8_t type_tag = type.TagPart();
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1499
        nsXPTCMiniVariant* pv;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1500
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1501
        if (param.IsDipper())
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1502
            pv = (nsXPTCMiniVariant*) &nativeParams[i].val.p;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1503
        else
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1504
            pv = (nsXPTCMiniVariant*) nativeParams[i].val.p;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1505
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1506
        if (param.IsRetval())
50465
c2411a6276fc54fd73c5c90edbfc838947c28934 Bug 579183 - loosen-up StackSegment invariants - part 2 - xpconnect (r=mrbkap)
Luke Wagner <lw@mozilla.com>
parents: 48503
diff changeset
  1507
            val = rval;
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1508
        else if (JSVAL_IS_PRIMITIVE(argv[i]) ||
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1509
                 !JS_GetPropertyById(cx, JSVAL_TO_OBJECT(argv[i]),
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1510
                                     mRuntime->GetStringID(XPCJSRuntime::IDX_VALUE),
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
  1511
                                     val.address()))
29946
e7c62fc3b92bc0ecefaeefd7db0db76dbf23c7ea Bug 496441 - Some random cleanup: remove an unnecessary macro. r+sr=jst
Blake Kaplan <mrbkap@gmail.com>
parents: 28734
diff changeset
  1512
            break;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1513
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1514
        // setup allocator and/or iid
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1515
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1516
        if (type_tag == nsXPTType::T_INTERFACE) {
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1517
            if (NS_FAILED(GetInterfaceInfo()->
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1518
                          GetIIDForParamNoAlloc(methodIndex, &param,
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1519
                                                &param_iid)))
29946
e7c62fc3b92bc0ecefaeefd7db0db76dbf23c7ea Bug 496441 - Some random cleanup: remove an unnecessary macro. r+sr=jst
Blake Kaplan <mrbkap@gmail.com>
parents: 28734
diff changeset
  1520
                break;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1521
        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1522
134048
9ab08f6d22582cc760e8dabf55da730556a7a0d0 Bug 877261 - Stop using XPCCallContext for XPCConvert. r=Ms2ger
Bobby Holley <bobbyholley@gmail.com>
parents: 133709
diff changeset
  1523
        if (!XPCConvert::JSData2Native(&pv->val, val, type,
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1524
                                       !param.IsDipper(), &param_iid, nullptr))
29946
e7c62fc3b92bc0ecefaeefd7db0db76dbf23c7ea Bug 496441 - Some random cleanup: remove an unnecessary macro. r+sr=jst
Blake Kaplan <mrbkap@gmail.com>
parents: 28734
diff changeset
  1525
            break;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1526
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1527
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1528
    // if any params were dependent, then we must iterate again to convert them.
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1529
    if (foundDependentParam && i == paramCount) {
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1530
        for (i = 0; i < paramCount; i++) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1531
            const nsXPTParamInfo& param = info->params[i];
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1532
            if (!param.IsOut())
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1533
                continue;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1534
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1535
            const nsXPTType& type = param.GetType();
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1536
            if (!type.IsDependent())
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1537
                continue;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1538
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
  1539
            RootedValue val(cx);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1540
            nsXPTCMiniVariant* pv;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1541
            nsXPTType datum_type;
82768
d6d732ef5650562f1f1593df4bd446614e3f2dfa Bug 708735 - Use <stdint.h> types in JSAPI and throughout SpiderMonkey. Continue to provide the {u,}int{8,16,32,64} and JS{Uint,Int}{8,16,32,64} integer types through a single header, however, for a simpler backout strategy -- and also to ease the transition for embedders. r=timeless on switching the jsd API to use the <stdint.h> types, r=luke, r=dmandelin
Jeff Walden <jwalden@mit.edu>
parents: 80807
diff changeset
  1542
            uint32_t array_count;
77799
e7854b4d29ba905ae3994f821b160c989bac4260 Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
Michael Wu <mwu@mozilla.com>
parents: 77538
diff changeset
  1543
            bool isArray = type.IsArray();
e7854b4d29ba905ae3994f821b160c989bac4260 Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
Michael Wu <mwu@mozilla.com>
parents: 77538
diff changeset
  1544
            bool isSizedString = isArray ?
80807
3258ba3a269d5e865b720c853120e088d4537e10 Bug 701467 - Remove JS_TRUE/JS_FALSE from xpconnect; r=bholley
Ms2ger <ms2ger@gmail.com>
parents: 80787
diff changeset
  1545
                    false :
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1546
                    type.TagPart() == nsXPTType::T_PSTRING_SIZE_IS ||
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1547
                    type.TagPart() == nsXPTType::T_PWSTRING_SIZE_IS;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1548
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1549
            pv = (nsXPTCMiniVariant*) nativeParams[i].val.p;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1550
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1551
            if (param.IsRetval())
50465
c2411a6276fc54fd73c5c90edbfc838947c28934 Bug 579183 - loosen-up StackSegment invariants - part 2 - xpconnect (r=mrbkap)
Luke Wagner <lw@mozilla.com>
parents: 48503
diff changeset
  1552
                val = rval;
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1553
            else if (!JS_GetPropertyById(cx, JSVAL_TO_OBJECT(argv[i]),
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1554
                                         mRuntime->GetStringID(XPCJSRuntime::IDX_VALUE),
128577
4eef306e01569ddb07017c71115879397be317f0 Bug 860777 - Part 1 - Root XPCWrappedJSClass.cpp r=bholley
Jon Coppeard <jcoppeard@mozilla.com>
parents: 128491
diff changeset
  1555
                                         val.address()))
29946
e7c62fc3b92bc0ecefaeefd7db0db76dbf23c7ea Bug 496441 - Some random cleanup: remove an unnecessary macro. r+sr=jst
Blake Kaplan <mrbkap@gmail.com>
parents: 28734
diff changeset
  1556
                break;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1557
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1558
            // setup allocator and/or iid
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1559
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1560
            if (isArray) {
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1561
                if (NS_FAILED(mInfo->GetTypeForParam(methodIndex, &param, 1,
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1562
                                                     &datum_type)))
29946
e7c62fc3b92bc0ecefaeefd7db0db76dbf23c7ea Bug 496441 - Some random cleanup: remove an unnecessary macro. r+sr=jst
Blake Kaplan <mrbkap@gmail.com>
parents: 28734
diff changeset
  1563
                    break;
78744
25a5c9891392c72ac42f2771176d3f0d803ae890 Bug 688012 - Hoist 'else' clauses to the line of the previous close-curly-brace. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78743
diff changeset
  1564
            } else
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1565
                datum_type = type;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1566
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1567
            if (datum_type.IsInterfacePointer()) {
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1568
               if (!GetInterfaceTypeFromParam(cx, info, param, methodIndex,
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1569
                                              datum_type, nativeParams,
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1570
                                              &param_iid))
29946
e7c62fc3b92bc0ecefaeefd7db0db76dbf23c7ea Bug 496441 - Some random cleanup: remove an unnecessary macro. r+sr=jst
Blake Kaplan <mrbkap@gmail.com>
parents: 28734
diff changeset
  1571
                   break;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1572
            }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1573
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1574
            if (isArray || isSizedString) {
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1575
                if (!GetArraySizeFromParam(cx, info, param, methodIndex,
79867
104c466724acd2cb7e9d3b648d140f355510bb15 Bug 677788 - Remove use of length_is xpt value from gecko. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 79866
diff changeset
  1576
                                           i, nativeParams, &array_count))
29946
e7c62fc3b92bc0ecefaeefd7db0db76dbf23c7ea Bug 496441 - Some random cleanup: remove an unnecessary macro. r+sr=jst
Blake Kaplan <mrbkap@gmail.com>
parents: 28734
diff changeset
  1577
                    break;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1578
            }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1579
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1580
            if (isArray) {
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1581
                if (array_count &&
134048
9ab08f6d22582cc760e8dabf55da730556a7a0d0 Bug 877261 - Stop using XPCCallContext for XPCConvert. r=Ms2ger
Bobby Holley <bobbyholley@gmail.com>
parents: 133709
diff changeset
  1582
                    !XPCConvert::JSArray2Native((void**)&pv->val, val,
79866
6c1a7d01303f1497a439ae399828ef09074484de Bug 677788 - Remove array/string 'capacity' argument from XPCConvert. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 79102
diff changeset
  1583
                                                array_count, datum_type,
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1584
                                                &param_iid, nullptr))
29946
e7c62fc3b92bc0ecefaeefd7db0db76dbf23c7ea Bug 496441 - Some random cleanup: remove an unnecessary macro. r+sr=jst
Blake Kaplan <mrbkap@gmail.com>
parents: 28734
diff changeset
  1585
                    break;
78744
25a5c9891392c72ac42f2771176d3f0d803ae890 Bug 688012 - Hoist 'else' clauses to the line of the previous close-curly-brace. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78743
diff changeset
  1586
            } else if (isSizedString) {
134048
9ab08f6d22582cc760e8dabf55da730556a7a0d0 Bug 877261 - Stop using XPCCallContext for XPCConvert. r=Ms2ger
Bobby Holley <bobbyholley@gmail.com>
parents: 133709
diff changeset
  1587
                if (!XPCConvert::JSStringWithSize2Native((void*)&pv->val, val,
79866
6c1a7d01303f1497a439ae399828ef09074484de Bug 677788 - Remove array/string 'capacity' argument from XPCConvert. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 79102
diff changeset
  1588
                                                         array_count, datum_type,
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1589
                                                         nullptr))
29946
e7c62fc3b92bc0ecefaeefd7db0db76dbf23c7ea Bug 496441 - Some random cleanup: remove an unnecessary macro. r+sr=jst
Blake Kaplan <mrbkap@gmail.com>
parents: 28734
diff changeset
  1590
                    break;
78744
25a5c9891392c72ac42f2771176d3f0d803ae890 Bug 688012 - Hoist 'else' clauses to the line of the previous close-curly-brace. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78743
diff changeset
  1591
            } else {
134048
9ab08f6d22582cc760e8dabf55da730556a7a0d0 Bug 877261 - Stop using XPCCallContext for XPCConvert. r=Ms2ger
Bobby Holley <bobbyholley@gmail.com>
parents: 133709
diff changeset
  1592
                if (!XPCConvert::JSData2Native(&pv->val, val, type,
80807
3258ba3a269d5e865b720c853120e088d4537e10 Bug 701467 - Remove JS_TRUE/JS_FALSE from xpconnect; r=bholley
Ms2ger <ms2ger@gmail.com>
parents: 80787
diff changeset
  1593
                                               true, &param_iid,
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1594
                                               nullptr))
29946
e7c62fc3b92bc0ecefaeefd7db0db76dbf23c7ea Bug 496441 - Some random cleanup: remove an unnecessary macro. r+sr=jst
Blake Kaplan <mrbkap@gmail.com>
parents: 28734
diff changeset
  1595
                    break;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1596
            }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1597
        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1598
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1599
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1600
    if (i != paramCount) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1601
        // We didn't manage all the result conversions!
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1602
        // We have to cleanup any junk that *did* get converted.
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1603
83645
69fe2af4da71132bc31b8866e1bb9e96a1f97a21 Bug 714057 - Remove uintn users from XPConnect; r=bholley+khuey
Ms2ger <ms2ger@gmail.com>
parents: 83298
diff changeset
  1604
        for (uint8_t k = 0; k < i; k++) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1605
            const nsXPTParamInfo& param = info->params[k];
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1606
            if (!param.IsOut())
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1607
                continue;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1608
            const nsXPTType& type = param.GetType();
80787
e8df70ae53e2b693d2a16b2bda022cbb7e7eef47 Bug 692342 - Introduce deprecated_IsPointer() to handle the cases that are too mucky to figure out right now. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 80786
diff changeset
  1609
            if (!type.deprecated_IsPointer())
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1610
                continue;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1611
            void* p;
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1612
            if (!(p = nativeParams[k].val.p))
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1613
                continue;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1614
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1615
            if (type.IsArray()) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1616
                void** pp;
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1617
                if (nullptr != (pp = *((void***)p))) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1618
                    // we need to get the array length and iterate the items
82768
d6d732ef5650562f1f1593df4bd446614e3f2dfa Bug 708735 - Use <stdint.h> types in JSAPI and throughout SpiderMonkey. Continue to provide the {u,}int{8,16,32,64} and JS{Uint,Int}{8,16,32,64} integer types through a single header, however, for a simpler backout strategy -- and also to ease the transition for embedders. r=timeless on switching the jsd API to use the <stdint.h> types, r=luke, r=dmandelin
Jeff Walden <jwalden@mit.edu>
parents: 80807
diff changeset
  1619
                    uint32_t array_count;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1620
                    nsXPTType datum_type;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1621
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1622
                    if (NS_SUCCEEDED(mInfo->GetTypeForParam(methodIndex, &param,
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1623
                                                            1, &datum_type)) &&
80787
e8df70ae53e2b693d2a16b2bda022cbb7e7eef47 Bug 692342 - Introduce deprecated_IsPointer() to handle the cases that are too mucky to figure out right now. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 80786
diff changeset
  1624
                        datum_type.deprecated_IsPointer() &&
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1625
                        GetArraySizeFromParam(cx, info, param, methodIndex,
79867
104c466724acd2cb7e9d3b648d140f355510bb15 Bug 677788 - Remove use of length_is xpt value from gecko. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 79866
diff changeset
  1626
                                              k, nativeParams, &array_count) &&
104c466724acd2cb7e9d3b648d140f355510bb15 Bug 677788 - Remove use of length_is xpt value from gecko. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 79866
diff changeset
  1627
                        array_count) {
104c466724acd2cb7e9d3b648d140f355510bb15 Bug 677788 - Remove use of length_is xpt value from gecko. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 79866
diff changeset
  1628
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1629
                        CleanupPointerArray(datum_type, array_count, pp);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1630
                    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1631
                    nsMemory::Free(pp);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1632
                }
78744
25a5c9891392c72ac42f2771176d3f0d803ae890 Bug 688012 - Hoist 'else' clauses to the line of the previous close-curly-brace. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78743
diff changeset
  1633
            } else
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1634
                CleanupPointerTypeObject(type, (void**)p);
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1635
            *((void**)p) = nullptr;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1636
        }
78744
25a5c9891392c72ac42f2771176d3f0d803ae890 Bug 688012 - Hoist 'else' clauses to the line of the previous close-curly-brace. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78743
diff changeset
  1637
    } else {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1638
        // set to whatever the JS code might have set as the result
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1639
        retval = pending_result;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1640
    }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1641
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1642
    return retval;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1643
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1644
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1645
const char*
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1646
nsXPCWrappedJSClass::GetInterfaceName()
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1647
{
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1648
    if (!mName)
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1649
        mInfo->GetName(&mName);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1650
    return mName;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1651
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1652
137301
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1653
static void
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1654
FinalizeStub(JSFreeOp *fop, JSObject *obj)
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1655
{
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1656
}
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1657
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1658
static JSClass XPCOutParamClass = {
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1659
    "XPCOutParam",
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1660
    0,
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1661
    JS_PropertyStub,
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1662
    JS_DeletePropertyStub,
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1663
    JS_PropertyStub,
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1664
    JS_StrictPropertyStub,
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1665
    JS_EnumerateStub,
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1666
    JS_ResolveStub,
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1667
    JS_ConvertStub,
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1668
    FinalizeStub,
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1669
    NULL,   /* checkAccess */
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1670
    NULL,   /* call */
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1671
    NULL,   /* hasInstance */
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1672
    NULL,   /* construct */
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1673
    NULL    /* trace */
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1674
};
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1675
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1676
bool
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1677
xpc::IsOutObject(JSContext* cx, JSObject* obj)
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1678
{
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1679
    return js::GetObjectJSClass(obj) == &XPCOutParamClass;
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1680
}
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1681
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1682
JSObject*
137301
0c45375d507ee8699f6a25760263234f7c9e8823 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug).
David Anderson <danderson@mozilla.com>
parents: 135085
diff changeset
  1683
xpc::NewOutObject(JSContext* cx, JSObject* scope)
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1684
{
100844
b5c4b792f3f2a047e3517472d72842a76afb77cd Bug 777292 part 2 - Change all nsnull to nullptr
Aryeh Gregor <ayg@aryeh.name>
parents: 100223
diff changeset
  1685
    return JS_NewObject(cx, nullptr, nullptr, JS_GetGlobalForObject(cx, scope));
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1686
}
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1687
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1688
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1689
NS_IMETHODIMP
102997
a16372ce30b5f6b747246b01fcd215a4bf3b6342 Bug 579517 - Part 1: Automated conversion of NSPR numeric types to stdint types in Gecko; r=bsmedberg
Ehsan Akhgari <ehsan@mozilla.com>
parents: 100875
diff changeset
  1690
nsXPCWrappedJSClass::DebugDump(int16_t depth)
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1691
{
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1692
#ifdef DEBUG
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1693
    depth-- ;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1694
    XPC_LOG_ALWAYS(("nsXPCWrappedJSClass @ %x with mRefCnt = %d", this, mRefCnt.get()));
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1695
    XPC_LOG_INDENT();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1696
        char* name;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1697
        mInfo->GetName(&name);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1698
        XPC_LOG_ALWAYS(("interface name is %s", name));
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1699
        if (name)
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1700
            nsMemory::Free(name);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1701
        char * iid = mIID.ToString();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1702
        XPC_LOG_ALWAYS(("IID number is %s", iid ? iid : "invalid"));
78742
0a2a7c748da6a979a262067d5ae4684db82b7c52 Bug 688012 - Add space between keyword and paren for: if, for, while, and switch. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78741
diff changeset
  1703
        if (iid)
30833
44fab2f1ab6464c31f431e17e2b524d7767f2f72 Bug 392526. Some callers of nsID::ToString use a mismatched allocator to free the string. r=bsmedberg
David Zbarsky <dzbarsky@gmail.com>
parents: 30623
diff changeset
  1704
            NS_Free(iid);
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1705
        XPC_LOG_ALWAYS(("InterfaceInfo @ %x", mInfo));
83645
69fe2af4da71132bc31b8866e1bb9e96a1f97a21 Bug 714057 - Remove uintn users from XPConnect; r=bholley+khuey
Ms2ger <ms2ger@gmail.com>
parents: 83298
diff changeset
  1706
        uint16_t methodCount = 0;
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1707
        if (depth) {
83645
69fe2af4da71132bc31b8866e1bb9e96a1f97a21 Bug 714057 - Remove uintn users from XPConnect; r=bholley+khuey
Ms2ger <ms2ger@gmail.com>
parents: 83298
diff changeset
  1708
            uint16_t i;
4214
e52e5efd67ffc71e6d2715c7c5dfb0a3ccda996a Fix leak of xptiInterfaceInfo in DebugDump. b=389765 r+sr=jst a=DEBUG-only
dbaron@dbaron.org
parents: 3280
diff changeset
  1709
            nsCOMPtr<nsIInterfaceInfo> parent;
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1710
            XPC_LOG_INDENT();
4214
e52e5efd67ffc71e6d2715c7c5dfb0a3ccda996a Fix leak of xptiInterfaceInfo in DebugDump. b=389765 r+sr=jst a=DEBUG-only
dbaron@dbaron.org
parents: 3280
diff changeset
  1711
            mInfo->GetParent(getter_AddRefs(parent));
e52e5efd67ffc71e6d2715c7c5dfb0a3ccda996a Fix leak of xptiInterfaceInfo in DebugDump. b=389765 r+sr=jst a=DEBUG-only
dbaron@dbaron.org
parents: 3280
diff changeset
  1712
            XPC_LOG_ALWAYS(("parent @ %x", parent.get()));
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1713
            mInfo->GetMethodCount(&methodCount);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1714
            XPC_LOG_ALWAYS(("MethodCount = %d", methodCount));
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1715
            mInfo->GetConstantCount(&i);
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1716
            XPC_LOG_ALWAYS(("ConstantCount = %d", i));
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1717
            XPC_LOG_OUTDENT();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1718
        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1719
        XPC_LOG_ALWAYS(("mRuntime @ %x", mRuntime));
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1720
        XPC_LOG_ALWAYS(("mDescriptors @ %x count = %d", mDescriptors, methodCount));
78743
2efe763ee2ca511dd5461de4d5e9a013bc48e0f6 Bug 688012 - Move the open-brace for if, else, for, while, and switch to the same line as the keyword or condition. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78742
diff changeset
  1721
        if (depth && mDescriptors && methodCount) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1722
            depth--;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1723
            XPC_LOG_INDENT();
83645
69fe2af4da71132bc31b8866e1bb9e96a1f97a21 Bug 714057 - Remove uintn users from XPConnect; r=bholley+khuey
Ms2ger <ms2ger@gmail.com>
parents: 83298
diff changeset
  1724
            for (uint16_t i = 0; i < methodCount; i++) {
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1725
                XPC_LOG_ALWAYS(("Method %d is %s%s", \
78741
0b91a5164a64bdfe59ba94c8aa183d2d38ecee67 Bug 688012 - Fix alignment of arguments and tests relative to parens. r=mrbkap
Bobby Holley <bobbyholley@gmail.com>
parents: 78740
diff changeset
  1726
                                i, IsReflectable(i) ? "":" NOT ","reflectable"));
1
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1727
            }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1728
            XPC_LOG_OUTDENT();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1729
            depth++;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1730
        }
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1731
    XPC_LOG_OUTDENT();
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1732
#endif
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1733
    return NS_OK;
9b2a99adc05e53cd4010de512f50118594756650 Free the (distributed) Lizard! Automatic merge from CVS: Module mozilla: tag HG_REPO_INITIAL_IMPORT at 22 Mar 2007 10:30 PDT,
hg@mozilla.com
parents:
diff changeset
  1734
}