You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support mozbrowsericonchange event (Browser API) #8347
@glennw what would you recommend here? MozBrowserEvent::detail() returns a string. Maybe it should return a json-like data structure (hashmap?) that would be converted to jsval in HTMLIframeElement::dispatch_mozbrowser_event() ? But I'm not sure a hashmap is good enough. Do we have a generic JSON-like structure in Rust/Servo? Or should we translate to a jsval directly in MozBrowserEvent::detail()?
We have two JSON representations (first, second), but I propose making detail() take a MutHandleValue argument and directly converting the values rather than having a rust-typed common return.
@jdm I'm trying to use to_jsval in msg/constellation_msg.rs, so I guess I need use script::dom::bindings::conversions::{ToJSValConvertible}; which requires the script crate. Adding the script dependency in msg end up with a cyclic package dependency:
cyclic package dependency: package `devtools_traits v0.0.1 (file:///Users/paul/git/servo/components/servo)` depends on itself
Creating a BrowserIconChangeEventDetail dictionary is probably the way to go, rather than an interface. That should allow us to fill out the properties of the corresponding Rust object and then calling to_jsval.
Activity
paulrouget commentedon Nov 5, 2015
I'm giving it a try: paulrouget@97cee8b
At the moment, we are limited by the
event.detailproperty. It only supports strings (see https://github.com/servo/servo/blob/master/components/script/dom/htmliframeelement.rs#L133).@glennw what would you recommend here?
MozBrowserEvent::detail()returns a string. Maybe it should return a json-like data structure (hashmap?) that would be converted to jsval inHTMLIframeElement::dispatch_mozbrowser_event()? But I'm not sure a hashmap is good enough. Do we have a generic JSON-like structure in Rust/Servo? Or should we translate to a jsval directly inMozBrowserEvent::detail()?jdm commentedon Nov 5, 2015
We have two JSON representations (first, second), but I propose making
detail()take aMutHandleValueargument and directly converting the values rather than having a rust-typed common return.paulrouget commentedon Nov 6, 2015
@jdm I'm trying to use
to_jsvalinmsg/constellation_msg.rs, so I guess I needuse script::dom::bindings::conversions::{ToJSValConvertible};which requires thescriptcrate. Adding the script dependency in msg end up with a cyclic package dependency:What's the right approach in this case?
eefriedman commentedon Nov 6, 2015
Don't do that. You shouldn't be handling a JSContext outside of the script crate/thread.
jdm commentedon Nov 6, 2015
The right approach is to make 'detail' a method of a trait that's defined in the script crate.
paulrouget commentedon Nov 9, 2015
moving
detailinto the script crate works, but I'm having difficulties building the JS object.RootedObject::newandJS_DefineProperty(ordefine_properties)?to_jsval? This might require adding a new conversion methodconversions.rsBrowserIconChangeEventDetailinterface inBrowserElement.webidlhelp in any way?jdm commentedon Nov 9, 2015
Creating a
BrowserIconChangeEventDetaildictionary is probably the way to go, rather than an interface. That should allow us to fill out the properties of the corresponding Rust object and then callingto_jsval.paulrouget commentedon Nov 9, 2015
feedback? paulrouget@2f5fa1b
Does this look like the right approach?
Still need to do some clean-up, address the fixme, and write some tests
jdm commentedon Nov 9, 2015
It does!
Auto merge of #8449 - paulrouget:favicon, r=jdm
Auto merge of #8449 - paulrouget:favicon, r=jdm
Auto merge of #8449 - paulrouget:favicon, r=jdm