mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Modify URLExtraData rust debug to include referrerInfo.
Differential Revision: https://phabricator.services.mozilla.com/D36475
This commit is contained in:
parent
2ab9156401
commit
59cf10d1b0
2 changed files with 19 additions and 7 deletions
|
@ -303,6 +303,11 @@ impl_threadsafe_refcount!(
|
|||
bindings::Gecko_AddRefURLExtraDataArbitraryThread,
|
||||
bindings::Gecko_ReleaseURLExtraDataArbitraryThread
|
||||
);
|
||||
impl_threadsafe_refcount!(
|
||||
structs::nsIReferrerInfo,
|
||||
bindings::Gecko_AddRefnsIReferrerInfoArbitraryThread,
|
||||
bindings::Gecko_ReleasensIReferrerInfoArbitraryThread
|
||||
);
|
||||
impl_threadsafe_refcount!(
|
||||
structs::nsIURI,
|
||||
bindings::Gecko_AddRefnsIURIArbitraryThread,
|
||||
|
|
|
@ -178,20 +178,27 @@ impl UrlExtraData {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
impl fmt::Debug for UrlExtraData {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
struct DebugURI(*mut structs::nsIURI);
|
||||
impl fmt::Debug for DebugURI {
|
||||
macro_rules! define_debug_struct {
|
||||
($struct_name:ident, $gecko_class:ident, $debug_fn:ident) => {
|
||||
struct $struct_name(*mut structs::$gecko_class);
|
||||
impl fmt::Debug for $struct_name {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
use nsstring::nsCString;
|
||||
let mut spec = nsCString::new();
|
||||
unsafe {
|
||||
bindings::Gecko_nsIURI_Debug(self.0, &mut spec);
|
||||
bindings::$debug_fn(self.0, &mut spec);
|
||||
}
|
||||
spec.fmt(formatter)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
impl fmt::Debug for UrlExtraData {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
define_debug_struct!(DebugURI, nsIURI, Gecko_nsIURI_Debug);
|
||||
define_debug_struct!(DebugReferrerInfo, nsIReferrerInfo, Gecko_nsIReferrerInfo_Debug);
|
||||
|
||||
formatter
|
||||
.debug_struct("URLExtraData")
|
||||
|
@ -202,7 +209,7 @@ impl fmt::Debug for UrlExtraData {
|
|||
)
|
||||
.field(
|
||||
"referrer",
|
||||
&DebugURI(self.as_ref().mReferrer.raw::<structs::nsIURI>()),
|
||||
&DebugReferrerInfo(self.as_ref().mReferrerInfo.raw::<structs::nsIReferrerInfo>()),
|
||||
)
|
||||
.finish()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue