Commit graph

271 commits

Author SHA1 Message Date
Lars Bergstrom
948daf2422 This batch of changes upgrades Servo to work with the Rust upgrade as of
April 10, 2014. The main changes are to privacy, to work around the
issues with incorrect bounds on the libstd `Arc<Mutex<T>>`, and the
various API changes strewn throughout the libraries.
2014-04-27 15:46:12 -05:00
Ms2ger
06df422718 Remove the holderType return value of getJSToNativeConversionTemplate.
It is always None.
2014-04-25 16:24:21 +02:00
bors-servo
691d82a92f auto merge of #2228 : Ms2ger/servo/object-unwrapping-expressionify, r=jdm 2014-04-25 09:19:14 -04:00
Ms2ger
ee23074232 Remove unused function getUnionAccessorSignatureType. 2014-04-25 11:59:03 +02:00
Ms2ger
1d51e7d227 Rewrite dictionary codegen to initialize members directly into the struct. 2014-04-25 11:51:47 +02:00
Ms2ger
66c89f27aa Remove the 'retval' local variable from union TryConvertTo methods. 2014-04-25 11:33:18 +02:00
Ms2ger
05d0ba783f Move responsibility for assigning to ${declName} out of getJSToNativeConversionTemplate.
This commit does not make any change to the generated code.
2014-04-25 11:31:40 +02:00
Ms2ger
c5bf011d1e Rewrite the enumeration unwrapping to return an expression. 2014-04-25 10:55:16 +02:00
Ms2ger
2b9d1d6bc1 Rewrite the primitive unwrapping to return an expression. 2014-04-25 10:47:00 +02:00
Ms2ger
643ea874d1 Rewrite the any unwrapping to return an expression. 2014-04-25 10:47:00 +02:00
Ms2ger
1027801b04 Rewrite the DOMString unwrapping to return an expression. 2014-04-25 10:46:58 +02:00
Ms2ger
4905b22673 Rewrite the union unwrapping to return an expression. 2014-04-25 09:58:49 +02:00
Ms2ger
a9ffff9215 Rewrite the interface unwrapping to return an expression. 2014-04-25 09:58:49 +02:00
bors-servo
0745d656a3 auto merge of #2227 : Ms2ger/servo/assign-outside-match, r=jdm 2014-04-24 18:13:13 -04:00
Ms2ger
de8f123b1d Assign to 'this' immediately in CGAbstractBindingMethod.
This makes the generated code a bit more rustic.
2014-04-24 23:57:28 +02:00
Ms2ger
a6a06e0ffc Inline CGAbstractBindingMethod.getThis.
There's no good reason to keep this separate; it's only called once, and
inlining the function makes the code a little clearer.

This commit does not make any change to the generated code.
2014-04-24 23:52:27 +02:00
Ms2ger
82afae123e Move responsability for the assignment out of CastableObjectUnwrapper.
This is a second step towards making getJSToNativeConversionTemplate return an
expression, which will improve dictionary codegen in particular.

This commit does not make any change to the generated code.
2014-04-24 23:50:21 +02:00
Ms2ger
ab1b429aef Move assignments outside match expressions in getJSToNativeConversionTemplate.
This is a first step towards making getJSToNativeConversionTemplate return an
expression, which will improve dictionary codegen in particular.
2014-04-24 22:21:23 +02:00
Ms2ger
90f4d256cf Add support for dictionaries containing 'any'. 2014-04-24 21:50:20 +02:00
Josh Matthews
94dffca1e1 Remove all traces of WindowProxy. Implement basic browser context concept and outerizing of inner windows. 2014-04-22 10:57:25 -04:00
Ms2ger
4f9e119334 Remove JSPageInfo::js_compartment.
A js::rust::Compartment is little more than a glorified pointer to the
reflector of a window, so there's no good reason to use it. Instead, this
commit passes a JS<Window> directly when it's necessary.

This also means that we now have to use JS_DefineFunctions rather than
Compartment::define_functions; I believe the former is clearer to the reader
than the extra indirection involved in the latter calling through three
reopsitories.

This commit also simplifies ScriptTask::load to reuse the 'cx' local that is
in scope already, rather than refetching it through js_info.
2014-04-21 13:43:18 +02:00
Ms2ger
65ed97bab8 Introduce a get_dictionary_property function to reduce duplicated code in the dictionary conversion codegen.
This also explicitly disallows dictionary members without a default value, as
the code for those doesn't currently compile.

This is the second step of my planned rewrite of the dictionary initialization
that will remove the default values we currently use to initialize the
dictionary struct in the 'new' function.
2014-04-18 20:10:55 +02:00
Ms2ger
88c5e733b5 Merge the 'new' and 'Init' functions for dictionaries.
This moves the code in callers more in line with conversions for other types
and ensures the default values given to the dictionary fields (as defined by
the defaultValue function in CGDictionary.impl) do not escape the 'new'
method. The new code is also more in line with the code used by the
FromJSValConvertible trait.

This is the first step of my planned rewrite of the dictionary initialization
that will remove the default values entirely and reduce the code
duplication in the 'Init' (now 'new') function.
2014-04-18 17:12:20 +02:00
Ms2ger
8e596d142e Use 'exceptionCode' when converting to DOMString.
This change allows us to use the code even in cases where we return a
Result type rather than a JSBool. Interface, primitive and union types
already get this right.
2014-04-18 17:12:20 +02:00
bors-servo
58efe0bf75 auto merge of #2156 : Ms2ger/servo/codegen-deadcode, r=jdm 2014-04-18 10:28:11 -04:00
Ms2ger
857eb87bb6 Remove unused references to jsids in the generated code for dictionaries. 2014-04-18 15:52:40 +02:00
Ms2ger
9d7478ab8a Remove some dead code from codegen as found by pyflakes. 2014-04-18 15:52:40 +02:00
bors-servo
099815683d auto merge of #2155 : Ms2ger/servo/dictionary-codegen, r=jdm 2014-04-18 09:40:11 -04:00
Ms2ger
5ac5ba2468 Support nullable strings in dictionaries.
We copy the string in all cases, so there's no need to handle the isMember
case differently.
2014-04-18 11:37:56 +02:00
Ms2ger
4d20d1716d Implement support for default values for enumeration arguments. 2014-04-18 11:08:21 +02:00
Ms2ger
d53841b016 Handle exceptions from FindEnumStringIndex correctly.
The previous code would return success from the JSNative with a pending
exception, potentially leading to assertion failures inside the JS engine
later.
2014-04-18 10:18:24 +02:00
Ms2ger
baa3845362 Rewrite FindEnumStringIndex to distinguish 'value not found' and 'exception raised'.
This is in preparation for handling those cases differently.
2014-04-18 10:18:17 +02:00
Josh Matthews
742f73ded5 Add transparent Traceable and Untraceable types to aid proper rooting practices, and replace ad-hoc Untraceable structs with empty Encodable implementations. 2014-04-17 17:41:09 -04:00
Ms2ger
c9c96d4758 Ensure that optional primitive arguments aren't treated as nullable.
By forgetting the Some(), we caused type inference to convert to Option<T>
for optional non-nullable primitive arguments, and to Option<Option<T>> for
optional nullable primitive arguments (essentially the same thing). This
change brings the primitive codegen in line with the DOMString codegen.

Using distinct types for optionality and nullability would have prevented
this issue.
2014-04-17 16:23:09 +02:00
Ms2ger
f77b775e62 Remove unwrap_object.
There is no good reason to have both unwrap_object and unwrap_jsmanaged.
Removing unwrap_object simplifies the codegen and makes further
simplifications easier.
2014-04-16 11:54:46 +02:00
bors-servo
7149a25e91 auto merge of #2112 : Ms2ger/servo/IDLInterface-JS, r=jdm 2014-04-16 04:22:11 -04:00
Ms2ger
ac46cc6047 Implement FromJSValConvertible for JS<T>. 2014-04-15 21:33:18 +02:00
bors-servo
e4f33eb9b9 auto merge of #2114 : Ms2ger/servo/unused-obj-local-arg, r=jdm
This removes the local variable and prefixes the argument with an underscore.
Neither is used right now.
2014-04-15 12:22:44 -04:00
Ms2ger
e4305fe20e Remove unused variable 'obj' from binding functions.
This removes the local variable and prefixes the argument with an underscore.
Neither is used right now.
2014-04-15 17:37:54 +02:00
Ms2ger
dc11464933 Remove the return value from DefineDOMInterface.
This moves the assertion from its only caller into the function itself, to
clarify that we don't intent to deal with any failure here.
2014-04-15 17:32:10 +02:00
bors-servo
0c4354a439 auto merge of #2093 : Ms2ger/servo/DOMObjectPointerType, r=jdm 2014-04-10 15:16:17 -04:00
Ms2ger
493227c938 Remove DOMObjectPointerType. 2014-04-10 20:19:32 +02:00
Ms2ger
d11316fa05 Make GetCallableProperty more rustic. 2014-04-10 19:21:17 +02:00
Ms2ger
6c32a7f05f Remove getWrapTemplateForType and simplify wrapForType. 2014-04-10 13:08:54 +02:00
Ms2ger
8c4a3aa387 Use ToJSValConvertible for all conversions to JSVal. 2014-04-10 12:09:18 +02:00
Josh Matthews
b87d351fee Remove all traces of C wrappers for SpiderMonkey class stubs. 2014-04-08 10:15:12 -04:00
bors-servo
7541b57526 auto merge of #2051 : Ms2ger/servo/more-xray, r=jdm
On top of #2050
2014-04-07 13:01:16 -04:00
Ms2ger
2e2a39b8d5 Remove some more xray code. 2014-04-06 23:08:54 +02:00
bors-servo
86c83f7bfc auto merge of #2050 : sankha93/servo/rmxray, r=Ms2ger 2014-04-06 17:04:26 -04:00
Sankha Narayan Guria
9a4bec304f Remove XRay related stuff from codegen (fixes #1936) 2014-04-07 02:27:53 +05:30