Commit Graph

270 Commits

Author SHA1 Message Date
Peter Van der Beken
c996f76260 Bug 920196 - Make QueryInterface opt-in for WebIDL interfaces. r=bz.
--HG--
extra : rebase_source : 4cf7f9dc90f234dd663da05f27c0dc9484c7c0e1
2013-09-24 21:37:53 +02:00
Benoit Jacob
eeccdc3ba1 Bug 913847 - Include MainThreadUtils.h instead of nsThreadUtils.h - r=ehsan 2013-09-19 09:54:42 -04:00
Wes Kocher
0ef93db36c Backed out changeset 040522aacba4 (bug 913847) 2013-09-18 17:18:56 -07:00
Benoit Jacob
0fa6114162 Bug 913852 - BindingUtils.h doesn't need to include <algorithm> - r=bz 2013-09-18 18:50:32 -04:00
Benoit Jacob
6560634fb1 Bug 913847 - Include MainThreadUtils.h instead of nsThreadUtils.h - r=ehsan 2013-09-18 18:50:32 -04:00
Boris Zbarsky
81ea40a161 Bug 915419. Add support for "object" types in owning unions (so union return values and unions in dictionaries and sequences. r=dzbarsky, smaug
Adds RootedUnion and NullableRootedUnion structs that are used on the
stack for union return values when the union needs rooting.  It also
adds a TraceUnion method on union return values, which is called by
(Nullable)RootedUnion or by dictionary tracing.  TraceUnion traces
typed array and object members of unions (the only things unions can
contain so far that might need tracing).  Union return values are
changed to store raw JSObject* or typed array structs instead of
Rooted versions of both; the tracing is now handled via TraceUnion.

The wrapping code for dictionary arguments to constructors is fixed to
actually work.  This required adding GetAs* methods to union return
values that return references to the internal data.

The SetToObject method is adjusted to actually work for union return
value structs and not assume it's being generated for a
union-conversion struct, and we now generate SetToObject methods as
needed for union return values.
2013-09-12 22:34:16 -04:00
Dan Gohman
8b7074b6dc Bug 910823 - Constify static js::Class/JSClass instances. r=waldo 2013-09-11 05:49:05 -07:00
Olli Pettay
f805ec81b0 Bug 910910 - Enable Event ctors in workers, r=khuey
--HG--
extra : rebase_source : 983d01d13aa66a8499350a4960b5913b22c9783a
2013-09-10 21:27:32 +03:00
Ms2ger
1c16df3e56 Bug 913923 - Part b: Move OwningNonNull into its own header; r=dzbarsky
--HG--
rename : dom/bindings/BindingUtils.h => dom/bindings/OwningNonNull.h
2013-09-10 09:03:37 +02:00
Ms2ger
eb01beb01a Bug 913923 - Part a: Move UnionMember into its own header; r=dzbarsky 2013-09-10 09:03:37 +02:00
Kyle Huey
27e346e22d Bug 911258: Part 5 - Use the unified exception handling mechanism on workers. r=bz 2013-09-08 20:29:21 -07:00
Kyle Huey
abebd382da Bug 910937: Remove xpc_UnmarkGrayObject and use JSAPI directly. r=mccr8 2013-09-08 20:28:48 -07:00
Ehsan Akhgari
36280b9569 Bug 913531 - Remove the unnecessary #includes from nsIXPConnect.idl; r=bholley 2013-09-06 13:50:24 -04:00
Peter Van der Beken
bfe397843a Bug 905392 - Need way to throw web-console-visible exception-message from JS-implemented webidl object - bustage fix on a CLOSED TREE. 2013-09-06 15:27:25 +02:00
Peter Van der Beken
dcf5712030 Bug 905392 - Need way to throw web-console-visible exception-message from JS-implemented webidl object. r=bz. 2013-09-03 14:01:53 +02:00
Boris Zbarsky
2df33d9902 Bug 910795 part 2. Use the new Rebind() setup to avoid creating string copies for variadic string arguments. r=smaug 2013-09-04 16:43:12 -04:00
Boris Zbarsky
4b85e5c1ce Bug 868799 part 3. Use RootedTypedArray in codegen. r=smaug 2013-08-29 00:30:05 -04:00
Andrew McCreight
69fc8f5296 Bug 904826 - Remove some unneeded nsLayoutStatics calls. r=smaug,bholley,bz 2013-08-27 15:39:02 -07:00
Boris Zbarsky
a912d1fc13 Bug 908576 part 3. Get rid of PrototypeIDMap structs. r=smaug 2013-08-23 22:42:41 -04:00
Ms2ger
d329ccb29b Bug 907605 - Remove BindingUtils.h include from PrimitiveConversions.h; r=bz 2013-08-22 08:34:48 +02:00
Trevor Saunders
2dc15004c6 bug 905418 - get rid of more static constructors in dom/bindings/ r=smaug 2013-08-14 18:04:24 -04:00
Ms2ger
6d567ab3cc Bug 904110 - Move alignment features out of Util.h into a new header; r=Waldo 2013-08-14 09:00:52 +02:00
Jon Coppeard
11678aa48c Bug 903352 - Handlify remaining PropertyDescriptor APIs r=terrence r=bholley r=smaug 2013-08-12 12:09:14 +01:00
Peter Van der Beken
3256529063 Bug 895758. Make the global scope polluter a proxy. r=bzbarsky 2013-07-09 10:45:13 -04:00
Terrence Cole
61b15c2fbb Bug 862115 - Use Rooted<JSPropertyDescriptor> in favor of JSPropertyDescriptor::AutoRooter r=terrence r=smaug r=bholley 2013-04-30 10:29:40 -07:00
Nicholas Nethercote
b756f6b258 Bug 898914 (part 1) - Remove JSBool.
--HG--
extra : rebase_source : 2d202e0e5005a7f54724b1540481c15cde3ad52e
2013-08-08 15:53:04 -07:00
Boris Zbarsky
3c09e9975f Bug 897913 part 2. Allow touching interface objects via an Xray even if the page they're in can't touch them. r=bholley,smaug 2013-08-07 17:40:00 -04:00
Nicholas Nethercote
ba723f1034 Bug 901750 - Change return type of |JSNative| from |JSBool| to |bool|. code=nnethercote,jandem. r=luke,bz.
--HG--
extra : rebase_source : 5b3d7cc339af6d93bde078322e25c6e740d1b617
2013-08-02 00:41:57 -07:00
Boris Zbarsky
659c773366 Bug 900898 part 4. Support typed arrays inside sequences and variadics. r=smaug 2013-08-05 13:40:02 -04:00
Bill McCloskey
4c6e8822a8 Bug 899804 - Make CPOWs handle instanceof with WebIDL interfaces (r=bz,dvander) 2013-08-01 16:45:17 -07:00
Ehsan Akhgari
5ee21d6d3f Bug 895322 - Part 1: Replace the usages of MOZ_STATIC_ASSERT with C++11 static_assert; r=Waldo
This patch was mostly generated by running the following scripts on the codebase, with some
manual changes made afterwards:

# static_assert.sh
#!/bin/bash
# Command to convert an NSPR integer type to the equivalent standard integer type

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*/.hg*" \
       ! -wholename "obj-ff-dbg*" \
       ! -name nsXPCOMCID.h \
       ! -name prtypes.h \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.cc" \
         -o -iname "*.mm" \) | \
    xargs -n 1 `dirname $0`/assert_replacer.py #sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_STATIC_ASSERT static_assert
hg rev --no-backup mfbt/Assertions.h \
                   media/webrtc/signaling/src/sipcc/core/includes/ccapi.h \
                   modules/libmar/src/mar_private.h \
                   modules/libmar/src/mar.h


# assert_replacer.py
#!/usr/bin/python

import sys
import re

pattern = re.compile(r"\bMOZ_STATIC_ASSERT\b")

def replaceInPlace(fname):
  print fname
  f = open(fname, "rw+")
  lines = f.readlines()
  for i in range(0, len(lines)):
    while True:
      index = re.search(pattern, lines[i])
      if index != None:
        index = index.start()
        lines[i] = lines[i][0:index] + "static_assert" + lines[i][index+len("MOZ_STATIC_ASSERT"):]
        for j in range(i + 1, len(lines)):
          if lines[j].find("                 ", index) == index:
            lines[j] = lines[j][0:index] + lines[j][index+4:]
          else:
            break
      else:
        break
  f.seek(0, 0)
  f.truncate()
  f.write("".join(lines))
  f.close()

argc = len(sys.argv)
for i in range(1, argc):
  replaceInPlace(sys.argv[i])

--HG--
extra : rebase_source : 4b4a4047d82f2c205b9fad8d56dfc3f1afc0b045
2013-07-18 13:59:53 -04:00
Trevor Saunders
6f6c1a4a8a Bug 899368 - remove static constructors added in bug 894448 with some constexpr pixi dust. r=bz 2013-07-30 08:57:28 +09:00
Peter Van der Beken
30b93d7d6b Bug 894448 part 2 - Remove nativeOwnership = 'nsisupports'. r=bzbarsky 2013-07-04 17:24:59 +02:00
Ms2ger
36f3f6ae03 Bug 885170 - Remove nsINode::GetClassInfo(); r=peterv 2013-07-24 09:31:06 +02:00
Boris Zbarsky
c3d0e79b5c Bug 895009. Don't pass in NonNull/OwningNonNull arguments to WebIDL binding consumers. r=peterv 2013-07-22 08:15:43 -04:00
Jon Coppeard
c561caee58 Bug 888338 - 6 - more browser post barriers r=mccr8 2013-07-23 10:58:27 +01:00
Ryan VanderMeulen
cc66360dac Backed out changesets 0a196c0e9f96 (bug 895974) and 0d8aa14f5ed3 (bug 895009) for causing intermittent Linux32 mochitest-1 asserts on a CLOSED TREE. 2013-07-22 18:18:17 -04:00
Boris Zbarsky
12fbb7f6ba Bug 895009. Don't pass in NonNull/OwningNonNull arguments to WebIDL binding consumers. r=peterv 2013-07-22 08:15:43 -04:00
Nicholas Nethercote
8575db2cf1 Bug 887558 (part 2) - Move various functions into ProxyObject and FunctionProxyObject. r=jorendorff.
--HG--
extra : rebase_source : 14402b9ab7eda3389eb1b812ee961e46067b5b1d
2013-06-20 22:39:22 -07:00
Nicholas Nethercote
40833186f3 Bug 887558 (part 1) - Introduce ProxyObject and some sub-classes. r=jorendorff.
--HG--
extra : rebase_source : 33ed2aff35acbe4de8891a9fb34c60e7a314d9c8
2013-06-20 21:27:28 -07:00
Boris Zbarsky
f4b3a94323 Bug 891585. Don't JS_WrapValue same-compartment typed array return values in bindings code (e.g. ImageData.data). r=peterv 2013-07-11 11:58:29 -04:00
Kyle Huey
49b422d01c Bug 885866: Separate deferred finalization from XPConnect so we can use it off the main thread. r=mccr8, peterv, bsmedberg, jorendorff 2013-07-09 07:28:15 -07:00
Ehsan Akhgari
8b46075683 Bug 889016 - Part 1: Add an API to report a not-enough-arguments error in Web IDL bindings; r=bzbarsky 2013-07-04 09:24:49 -04:00
Jon Coppeard
4b40ce1453 Bug 885310 - 1 Rename JSHandleFoo in the browser r=bz 2013-06-21 14:12:46 +01:00
Andrea Marchesini
db524818c8 Bug 841442 - Move HTMLFormElement to WebIDL, r=bz 2013-06-19 10:24:37 -04:00
Jon Coppeard
c56ed4c7b6 Bug 884371 - Remove JSMutableHandleXXX from the browser r=bz 2013-06-19 11:32:27 +01:00
Boris Zbarsky
8a5f1751d4 Bug 883358 part 2. Use the new information in bindings error reporting. r=smaug 2013-06-17 16:31:13 -04:00
Ryan VanderMeulen
abc39cc023 Backed out 3 changesets (bug 883358) for Android mochitest-3 failures on a CLOSED TREE.
Backed out changeset 84b35dd1879d (bug 883358)
Backed out changeset b5e6522257cb (bug 883358)
Backed out changeset 757a3f2e5de6 (bug 883358)
2013-06-17 19:51:12 -04:00
Boris Zbarsky
2e6611eca0 Bug 883358 part 2. Use the new information in bindings error reporting. r=smaug 2013-06-17 16:31:13 -04:00
Boris Zbarsky
8c0782e121 Bug 882653 part 4. Improve the WebIDL binding error reporting for the not-sequence, not-callable, not-dictionary, not-date, and invalid-enum-value cases. r=smaug 2013-06-17 13:07:03 -04:00
Boris Zbarsky
c6981c480d Bug 882653 part 1. Improve error reporting for bogus this objects in WebIDL bindings. r=smaug 2013-06-17 13:07:03 -04:00
Peter Van der Beken
88cdaa8f8b Bug 851465 - Remove slim wrappers - remove various slim wrapper code and checks. r=bholley. 2013-04-19 21:57:18 +02:00
James Kitchener
411a37e6e9 Bug 796850 - Implement Code Generation for Bytestring in WebIDL bindings r=bz 2013-06-13 01:18:35 -04:00
Boris Zbarsky
6a7b47964f Bug 877281 part 6. Replace ${jsvalPtr} with a MutableHandle ${jsvalHandle}. r=peterv
It's a little unfortunate that we need both ${jsvalHandle} and
${jsvalRef}, but the only other option is to consistently have a
MutableHandle in this code.  If the thing we have to work with is a
Rooted, that means doing JS::MutableHandle<JS::Value>(&myRooted) as
the thing to substitute for ${jsvalHandle}.  Just using "&myRooted"
doesn't work, because things like "&myRooted.set()" or
"&myRooted.address()" fail, even if parenthesized as
"(&myRooted).set()", because &myRooted is actually a Rooted*, not a
MutableHandle.

We could go the JS::MutableHandle<JS::Value>(&myRooted) route if
desired; it would primarily uglify dictionary and sequence to-js
conversions.  With the setup in this patch, ideally it looks pretty
idiomatic except for the use of .set() instead of operator= on Rooted.
2013-06-07 22:45:46 -04:00
Ms2ger
1e339d398b Bug 876602 - Move JS-implemented webidl construction code into C++; r=bz 2013-06-01 08:56:23 +02:00
Ms2ger
c1c1a92c3b Bug 876604 - Outparamdel UnwrapDOMObjectToISupports; r=bz 2013-06-01 08:56:02 +02:00
Peter Van der Beken
44c790a6fb Bug 874321 - Fix setting of expandos on Xrays for DOM bindings with named properties. r=bz.
--HG--
extra : rebase_source : 697545417d27696de05c0f22987e4cb187d226cd
2013-05-29 11:38:57 +02:00
Kyle Huey
3cc4ccd2f5 Bug 876555: Avoid including xpcprivate.h in most generated dom binding code. r=bz 2013-05-30 11:15:31 +08:00
Boris Zbarsky
5033ec2b7b Bug 875622 part 2. Use handles in ConvertJSValueToString. r=smaug 2013-05-24 09:16:00 -04:00
Boris Zbarsky
0307d91885 Bug 865951. If the return value of a JS-implemented method or attribute is a JS-implemented interface and the returned object is not a DOM object, automatically wrap it up in an instance of that interface. r=mccr8
This does not invoke __init on the chrome object, since there are no
arguments to do it with anyway.  It also doesn't invoke init(), so
don't do this in cases in which the chrome-side object will need to
know its window.
2013-05-20 13:47:08 -04:00
Boris Zbarsky
fd290b314c Bug 868312 finale: finish rooting dom/ code. r=smaug 2013-05-17 21:48:25 -04:00
Boris Zbarsky
8fc54ee80a Bug 873337. Change the order of the decl and holder in js-to-native conversions to clean up the code some. Now the holder always comes after the decl. r=smaug 2013-05-17 21:48:25 -04:00
Nathan Froyd
256a7169e6 Bug 873479 - fix BindingUtils.h to compile with GCC 4.4 in non-C++0x mode; r=bz 2013-05-17 10:44:19 -04:00
Boris Zbarsky
71fd53bf82 Bug 868715 part 8. Add tracing to WebIDL sequence return values. r=peterv 2013-05-16 12:36:56 -04:00
Boris Zbarsky
ac41ff38fd Bug 868715 part 7. Add tracing to dictionaries. r=peterv 2013-05-16 12:36:55 -04:00
Boris Zbarsky
070682bbbc Bug 868715 part 6. Add the ability to trace sequence arguments. r=peterv 2013-05-16 12:36:55 -04:00
Boris Zbarsky
fa5496e7a4 Bug 868715 part 4. Use on-stack Rooted<JSObject*> for 'object' arguments in WebIDL bindings. r=peterv 2013-05-16 12:36:55 -04:00
Boris Zbarsky
acfc919f60 Bug 871177. Fix rooting hazard in IsNotDateOrRegexp. r=smaug 2013-05-15 21:46:44 -04:00
Terrence Cole
cd1aec056b Bug 777548 - Make non-cc-participant tracing indirect; r=smaug,billm,jst 2013-03-28 13:37:22 -07:00
Boris Zbarsky
299d72713e Bug 867863. Be a little more careful in GlobalObject initialization. r=peterv 2013-05-08 15:50:58 -04:00
Boris Zbarsky
4f17ea0254 Bug 869311. More rooting in dom/bindings and content/base. r=smaug 2013-05-07 22:34:56 -04:00
Boris Zbarsky
34bb423d34 Bug 865969 part 9. Remaining miscellaneous rooting fixes in WebIDL bindings. r=ms2ger 2013-05-03 19:29:09 -04:00
Boris Zbarsky
fba1502aa7 Bug 865969 part 6. Fix rooting hazards in BindingUtils.cpp. r=smaug 2013-05-03 19:29:08 -04:00
Boris Zbarsky
4d5cf6450f Bug 865969 part 1. Better rooting in bindings for 'object' arguments, as well as for worker interface arguments passed as JSObject*. r=smaug 2013-05-03 19:29:07 -04:00
David Zbarsky
33b84ccd33 Bug 866450 Part 1: Fix rooting hazards under content/ and dom/ r=bz 2013-05-02 05:12:45 -04:00
Boris Zbarsky
d0cb8316ab Bug 860841. Hook up the proto chain of a WebIDL interface object to the interface object of its nearest ancestor interface that has one, as if these were ES6 classes. r=peterv 2013-05-02 14:38:19 -04:00
Ed Morley
38f36edd9e Backed out changeset ad10907da2d4 (bug 866450) for B2G build failures 2013-05-02 11:58:05 +01:00
David Zbarsky
62df33d2a0 Bug 866450 Part 1: Fix rooting hazards under content/ and dom/ r=bz 2013-05-02 05:12:45 -04:00
Boris Zbarsky
583e53379d Bug 861022 part 2. Root the global object in WebIDL prototype and interface object setup. r=peterv,terrence 2013-05-01 23:44:12 -04:00
Boris Zbarsky
e418358f16 Bug 861022 part 1. Root the non-globals in WebIDL prototype and interface object setup. r=peterv,terrence 2013-05-01 23:44:11 -04:00
Boris Zbarsky
15316b1400 Bug 865961. Root the scope argument of wrap-the-xpconnect-object helpers in WebIDL bindings. r=ms2ger 2013-04-29 17:33:42 -04:00
Boris Zbarsky
8003a22424 Bug 717637. Stop using non-global parent objects for everything that's not an element, since having a mix of parent objects makes us fail shape guards in the JIT. r=peterv 2013-04-29 17:33:41 -04:00
Boris Zbarsky
e9fca1d653 Bug 865964. Remove dead WrapCallbackInterface code. r=smaug 2013-04-26 13:41:21 -04:00
Boris Zbarsky
9ba2beac5c Bug 766583 part 1. Stop declaring dictionaries as const on the stack in bindings code. r=smaug 2013-04-25 19:03:06 -04:00
Boris Zbarsky
7a5392b28d Bug 861493. When passing arguments to an Xray for a WebIDL constructor, make sure to do the argument unwrapping before entering the content compartment. r=bholley,waldo
There are several changes here:

1) Adds some MutableThis methods to Optional, Nullable, and dictionaries to
   effectively allow doing a const_cast without knowing the actual type being
   templated over.  I needed this because I do not in fact know that type in
   the relevant code.  I'm open to suggestions for a better name for this
   method.
2) Adds some operator& to RootedJSValue to make it look more like a JS::Value,
   and in particular so I can JS_WrapValue the thing in it.
3) Adds a Slot() method to NonNullLazyRootedObject, just like NonNull has.
4) Adds an operator& to LazyRootedObject to make it look more like JSObject* so
   I can JS_WrapObject the thing in it.
5) Implements the actual rewrapping of the arguments into the content compartment.
6) Fixes a small preexisting bug in which we didn't look at named constructors
   in getTypesFromDescriptor (this was causing my tests to not compile).
7) Changes Xrays to not enter the content compartment when calling a WebIDL
   constructor.
8) Adds some friend API to report things as not being functions.
2013-04-25 19:03:05 -04:00
Boris Zbarsky
9c1973b5d2 Bug 864727 part 5. Make all the WrapObject methods take a handle for the scope object. r=ms2ger 2013-04-25 12:29:54 -04:00
Boris Zbarsky
0b6ba06beb Bug 864727 part 4. Pass a handle for the scope object to all the various Wrap*Object stuff in BindingUtils. r=ms2ger
Note: The JS::Rooted in CGWrapWithCacheMethod is just there until we start passing a handle to Wrap().
2013-04-25 12:29:53 -04:00
Boris Zbarsky
498c958a33 Bug 864590. Assert that the object is not null when wrapping WebIDL objects. r=peterv 2013-04-24 14:59:15 -04:00
Peter Van der Beken
bd68680410 Bug 852094 - Support Unforgeable on proxy-based DOM bindings. r=bz. 2012-12-20 10:56:11 +01:00
David Zbarsky
5dda7256e6 Bug 857439 Followup: Add null-checks for WrapObject failing and assert that the JSObject took ownership if WrapObject succeeded r=bz 2013-04-19 18:18:31 -04:00
David Zbarsky
8ce74aae9d Bug 857439 Part 3: Make sure to delete owned interfaces if wrapping fails r=bz 2013-04-19 04:49:21 -04:00
Jon Coppeard
1f1c0e6af9 Bug 861281 - GC: Root the wrap object API r=terrence r=bholley
--HG--
extra : rebase_source : 1d3ed88299ad8e9ad6812fb41aa48f03cc7aabae
2013-04-15 18:32:55 +01:00
Jacek Szpot
514f40e52a Bug 854503 - Rename JS unwrapping functions. r=bholley 2013-04-11 11:50:18 -07:00
Boris Zbarsky
ecc404d587 Bug 688691. Warn when LenientThis actually causes us to not throw. r=ms2ger 2013-04-08 17:04:21 -04:00
Ryan VanderMeulen
24a4c17eff Backed out changeset a85d21e394c0 (bug 854503) for bustage. 2013-04-06 14:37:33 -04:00
Jacek Szpot
8ce12e971c Bug 854503 - Rename JS unwrapping functions. r=bholley 2013-04-04 12:14:32 +02:00
Boris Zbarsky
0d9204981d Bug 855700. Make returning an nsIVariant from a WebIDL interface work. r=smaug 2013-04-03 22:22:16 -04:00
Boris Zbarsky
b105f502e9 Bug 855582 part 2. Make the bindings' various spec arrays const, and make the jitinfo structs static. r=khuey 2013-04-02 20:20:38 -04:00
Boris Zbarsky
52855cafca Bug 856833 part 3. Rip out no longer needed proxy-unwrapping code. r=waldo 2013-04-02 20:20:37 -04:00
Bobby Holley
e231772ba1 Bug 854480 - Remove old-style unwrapping from dom/bindings bindings. r=bz 2013-04-01 15:17:50 -07:00