Commit graph

704 commits

Author SHA1 Message Date
Ms2ger
b51e83819d Fix obsolete format traits.
They are to be removed from the language in the next rust upgrade.
2015-01-02 19:04:18 +01:00
bors-servo
141b5d038f auto merge of #4526 : servo/servo/deref-1, r=Manishearth
This is a start towards fixing #3868. Not all callers have been fixed yet, so the `Deref` implementation remains for now.
2015-01-02 09:22:51 -07:00
Ms2ger
203d1669c8 Construct a new JSRef in Root::r(). 2015-01-02 10:28:24 +01:00
Ms2ger
43eecf6e7a Stop using ptr.is_not_null() in script.
This method is deprecated in rust master; removing its users in advance will
make a future rust upgrade smoother.
2015-01-01 22:19:34 +01:00
Ms2ger
6077ed0ce8 Rename GlobalRoot::root_ref() to GlobalRoot::r() for consistency. 2015-01-01 20:38:04 +01:00
Ms2ger
d09d245ee1 Remove unsound Root::deref() calls in HTML elements. 2015-01-01 20:36:45 +01:00
Ms2ger
6032a2f8af Remove unsound Root::deref() calls in DOMParser::ParseFromString.
Note that Root::clone() calls through to JSRef::clone() due to autoderef.
2015-01-01 20:36:45 +01:00
Ms2ger
ca9b5353d8 Remove unsound Root::deref() call in Document::set_quirks_mode. 2015-01-01 20:36:45 +01:00
Ms2ger
eb715a7bf8 Convince borrowck that Document::createNodeList is sound. 2015-01-01 20:36:44 +01:00
Ms2ger
e5ae267e80 Remove unsound Root::deref() call in Document::get_html_element. 2015-01-01 20:36:44 +01:00
Ms2ger
ff96d8ccd4 Remove unsound Root::deref() calls in CSSStyleDeclaration. 2015-01-01 20:36:44 +01:00
Ms2ger
740ee84809 Remove unsound Root::deref() call in BrowserContext::create_window_proxy. 2015-01-01 20:36:44 +01:00
Ms2ger
925058ef26 Remove unsound Root::deref() calls in XMLHttpRequest. 2015-01-01 20:36:44 +01:00
Ms2ger
a094c0a7f3 Remove unsound Root::deref() call in Attr::set_value.
This changes those calls whose unsoundness was not picked up by the type system
because of a lifetime constraint that cannot be expressed at this time.
2015-01-01 20:36:44 +01:00
Ms2ger
1dad710063 Replace Root::deref() calls by Root::r() calls where possible.
This changes those calls that were already sound.
2015-01-01 20:36:43 +01:00
Ms2ger
c9f26dfd59 Rename Root::root_ref() to Root::r().
As it will be used much more widely after the upcoming changes, this limits
the effort reading and writing the method calls.
2015-01-01 20:36:43 +01:00
Ms2ger
1290c18794 Remove the 'b lifetime from Root.
It does not add any safety, as the reference is constructed from a raw pointer
without limiting the lifetime in any way.
2015-01-01 20:36:43 +01:00
Ms2ger
95ec20bd97 Remove the 'a lifetime from Root.
It does not add any safety, as the reference is constructed from a raw pointer
without limiting the lifetime in any way.
2015-01-01 20:36:43 +01:00
bors-servo
111a196e9d auto merge of #4470 : shinglyu/servo/contentType, r=jdm
A follow-up for issue #1820, adds the optional "type" support.
2015-01-01 08:33:40 -07:00
bors-servo
fda38cf673 auto merge of #4496 : yodalee/servo/issue4484-ToJSValConvertible-for-str, r=jdm
#4484 
Add ToJSValConvertible trait to str type.
2015-01-01 03:00:44 -07:00
Shing Lyu
6df9b7fd3a Bug #1820, add the optional "type" parameter to Blob 2015-01-01 16:23:21 +08:00
yodalee
bb087c238b use str to_jsval() now
xmlhttprequest.rs, CodegenRust.py
replace into_string().to_jsval() to to_jsval()

conversions.rs
DOMString to_jsval() use as_slice().tojsval() now
2015-01-01 02:17:33 +08:00
Ms2ger
2669dac312 Use or_init for HTMLCanvasElement::GetContext. 2014-12-31 14:49:25 +01:00
yodalee
6f569dee92 add str ToJSValConvertible for str type 2014-12-31 20:20:44 +08:00
Ms2ger
b6117a57aa Replace the remaining to_string calls by into_string calls. 2014-12-31 10:34:44 +01:00
Bruno de Oliveira Abinader
bb577968e5 Codegen style fix 2014-12-30 12:40:49 -04:00
Bruno de Oliveira Abinader
7cca51b3b4 Codegen empty lines fix 2014-12-30 12:40:48 -04:00
Bruno de Oliveira Abinader
0721c624d9 Codegen indent fixes 2014-12-30 12:40:48 -04:00
Bruno de Oliveira Abinader
c950e3d61e Codegen whitespace fixes 2014-12-30 11:28:59 -04:00
bors-servo
2c259f477c auto merge of #4057 : jdm/servo/refcountdom, r=Ms2ger
This replaces the specialized TrustedXHRAddress and TrustedWorkerAddress code that was used for the same purpose. A non-zero refcount pins the given DOM object's reflector and prevents it from being GCed even when there are no other outstanding references visible to SpiderMonkey. This will enable us to implement asynchronous operations that refer to particular DOM objects (such as "queue a task to fire a simple event named load at the iframe element" from the spec) safely and conveniently, and paves the way for things like asynchronous network responses.

Some concerns about the resulting size of XHR progress messages have been expressed, but I believe optimizations to reduce that can be implemented in subsequent PRs.

r? @Ms2ger - note in particular the changes to the worker lifetime code. I couldn't figure out how to achieve an identical lifetime to the previous addref/release pairing, and I also was having trouble figuring out why the existing setup was safe. The new implementation now holds the main script task Worker object alive via the TrustedWorkerAddress field in the dedicated worker global scope, which is a significant difference.
2014-12-29 11:57:45 -07:00
Josh Matthews
9a7cd31134 Force all messages to worker tasks to send a TrustedWorkerAddress along with the ScriptMsg. This ensures that the main-thread Worker object is rooted for as long as there are events in flight or being processed. 2014-12-29 13:53:49 -05:00
Josh Matthews
2f059c15e7 Allow refcounting arbitrary DOM objects in concert with the GC to enable safe, asynchronous/cross-task references to pinned objects. 2014-12-29 13:53:48 -05:00
bors-servo
f76a460c53 auto merge of #4483 : brunoabinader/servo/named-deleter, r=Ms2ger
Closes #4469.
2014-12-29 10:21:51 -07:00
Bruno de Oliveira Abinader
ab618dd9c7 Add support for named deleter
Closes #4469.
2014-12-29 12:58:48 -04:00
bors-servo
1539051896 auto merge of #4501 : Ms2ger/servo/script_task, r=jdm 2014-12-29 09:54:45 -07:00
Ms2ger
a1d21d4c5e Simplify some code in handle_click_event. 2014-12-29 09:51:01 +01:00
ProgramFOX
18d8ee6ce0 Added readonly flag for CSSStyleDeclaration 2014-12-28 17:39:07 +01:00
bors-servo
56d1b16d1b auto merge of #4173 : Manishearth/servo/a-more-dom-struct, r=kmcallister
Now `#[dom_struct]` also generates Reflectable impls, and there's another lint to ensure that a DOM struct only contains one bare DOM field (as the first field) or a Reflector.

A lot of this was generated by sed -- each autogenerated change has its own commit for easy review; these will be squashed later.
2014-12-27 22:12:45 -07:00
Ms2ger
0031498e6b Remove some transmute calls. 2014-12-27 17:07:32 +01:00
Manish Goregaokar
e9d1740e19 script: to_string() -> into_string() 2014-12-27 14:48:36 +01:00
Manish Goregaokar
50c246bdc5 Fix warnings post-upgrade 2014-12-27 03:28:35 +05:30
Manish Goregaokar
21a888341d Ensure that Reflectors are the first field 2014-12-27 02:53:36 +05:30
Manish Goregaokar
d761877ef6 Add inheritance-checking lint 2014-12-27 02:53:35 +05:30
Manish Goregaokar
7d65673561 Remove extra spaces
Command: `find . -maxdepth 1 -type f -print0 | xargs -0 sed -z -i "s/}\\n\\n\\n/}\\n\\n/"`
2014-12-27 02:53:35 +05:30
Manish Goregaokar
552db382d6 Remove manual impls of Reflectors (autogen)
Obtained via:

 `find . -maxdepth 1 -type f -print0 | xargs -0 sed -z -i "s/\\nimpl Reflectable for[^{]*{[^}]*}[^}]*}\\n//"`
 `find . -maxdepth 1 -type f -print0 |xargs -0  grep -lZ dom_struct | xargs -0 grep -LZ  "reflector()\\|Reflector::new" |xargs -0 sed -z -i "s/use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};/use dom::bindings::utils::reflect_dom_object;/"`

followed by semi-automated removal of leftover imports
2014-12-27 02:52:33 +05:30
Bruno de Oliveira Abinader
5afcf3ef65 Implement DOMTokenList.toggle 2014-12-26 14:55:27 -04:00
Bruno de Oliveira Abinader
2cfb4648ce Implement DOMTokenList.remove 2014-12-26 14:55:27 -04:00
Bruno de Oliveira Abinader
aa29dc195d Implement DOMTokenList.add 2014-12-26 14:55:27 -04:00
Bruno de Oliveira Abinader
08e7cf24cd DOMTokenList::check_token_exceptions now returns an Atom 2014-12-26 14:55:26 -04:00
Bruno de Oliveira Abinader
51fac3d2cc Added Element::get_tokenlist_attribute 2014-12-26 14:55:26 -04:00