mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +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_AddRefURLExtraDataArbitraryThread,
|
||||||
bindings::Gecko_ReleaseURLExtraDataArbitraryThread
|
bindings::Gecko_ReleaseURLExtraDataArbitraryThread
|
||||||
);
|
);
|
||||||
|
impl_threadsafe_refcount!(
|
||||||
|
structs::nsIReferrerInfo,
|
||||||
|
bindings::Gecko_AddRefnsIReferrerInfoArbitraryThread,
|
||||||
|
bindings::Gecko_ReleasensIReferrerInfoArbitraryThread
|
||||||
|
);
|
||||||
impl_threadsafe_refcount!(
|
impl_threadsafe_refcount!(
|
||||||
structs::nsIURI,
|
structs::nsIURI,
|
||||||
bindings::Gecko_AddRefnsIURIArbitraryThread,
|
bindings::Gecko_AddRefnsIURIArbitraryThread,
|
||||||
|
|
|
@ -178,20 +178,27 @@ impl UrlExtraData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "gecko")]
|
macro_rules! define_debug_struct {
|
||||||
impl fmt::Debug for UrlExtraData {
|
($struct_name:ident, $gecko_class:ident, $debug_fn:ident) => {
|
||||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
struct $struct_name(*mut structs::$gecko_class);
|
||||||
struct DebugURI(*mut structs::nsIURI);
|
impl fmt::Debug for $struct_name {
|
||||||
impl fmt::Debug for DebugURI {
|
|
||||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||||
use nsstring::nsCString;
|
use nsstring::nsCString;
|
||||||
let mut spec = nsCString::new();
|
let mut spec = nsCString::new();
|
||||||
unsafe {
|
unsafe {
|
||||||
bindings::Gecko_nsIURI_Debug(self.0, &mut spec);
|
bindings::$debug_fn(self.0, &mut spec);
|
||||||
}
|
}
|
||||||
spec.fmt(formatter)
|
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
|
formatter
|
||||||
.debug_struct("URLExtraData")
|
.debug_struct("URLExtraData")
|
||||||
|
@ -202,7 +209,7 @@ impl fmt::Debug for UrlExtraData {
|
||||||
)
|
)
|
||||||
.field(
|
.field(
|
||||||
"referrer",
|
"referrer",
|
||||||
&DebugURI(self.as_ref().mReferrer.raw::<structs::nsIURI>()),
|
&DebugReferrerInfo(self.as_ref().mReferrerInfo.raw::<structs::nsIReferrerInfo>()),
|
||||||
)
|
)
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue