aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authorKagami Sascha Rosylight <saschanaz@outlook.com>2019-08-29 21:33:03 +0900
committerKagami Sascha Rosylight <saschanaz@outlook.com>2019-09-01 23:23:57 +0900
commit5695ee94a570a41d34a69b396db042922f63f516 (patch)
treec82d0ea21a04d3ee086d52483a237d4c085166f1 /components/script/dom
parent1af15054e77acb644c573e3252274652c72e7751 (diff)
downloadservo-5695ee94a570a41d34a69b396db042922f63f516.tar.gz
servo-5695ee94a570a41d34a69b396db042922f63f516.zip
Add [Default] toJSON() to performance interfaces
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py13
-rw-r--r--components/script/dom/webidls/Performance.webidl4
-rw-r--r--components/script/dom/webidls/PerformanceEntry.webidl3
-rw-r--r--components/script/dom/webidls/PerformanceNavigation.webidl2
-rw-r--r--components/script/dom/webidls/PerformanceNavigationTiming.webidl2
-rw-r--r--components/script/dom/webidls/PerformanceResourceTiming.webidl2
6 files changed, 15 insertions, 11 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 4a8cc573416..d5b70f6c3d7 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -2049,9 +2049,10 @@ class CGImports(CGWrapper):
if name != 'GlobalScope':
extras += [descriptor.path]
parentName = descriptor.getParentName()
- if parentName:
+ while parentName:
descriptor = descriptorProvider.getDescriptor(parentName)
extras += [descriptor.path, descriptor.bindingPath]
+ parentName = descriptor.getParentName()
elif t.isType() and t.isRecord():
extras += ['crate::dom::bindings::mozmap::MozMap']
elif isinstance(t, IDLPromiseType):
@@ -3662,6 +3663,7 @@ class CGDefaultToJSONMethod(CGSpecializedMethod):
def definition_body(self):
ret = dedent("""
+ use crate::dom::bindings::inheritance::HasParent;
rooted!(in(*cx) let result = JS_NewPlainObject(*cx));
if result.is_null() {
return false;
@@ -3676,16 +3678,19 @@ class CGDefaultToJSONMethod(CGSpecializedMethod):
jsonDescriptors.append(descriptor)
interface = interface.parent
+ parents = len(jsonDescriptors) - 1
form = """
- if !${parentclass}CollectJSONAttributes(cx, _obj, this, &result) {
+ if !${parentclass}CollectJSONAttributes(cx, _obj, this${asparent}, &result) {
return false;
}
"""
# Iterate the array in reverse: oldest ancestor first
for descriptor in jsonDescriptors[:0:-1]:
- ret += fill(form, parentclass=toBindingNamespace(descriptor.name) + "::")
- ret += fill(form, parentclass="")
+ ret += fill(form, parentclass=toBindingNamespace(descriptor.name) + "::",
+ asparent=".as_ref().unwrap()" + ".as_parent()" * parents)
+ parents -= 1
+ ret += fill(form, parentclass="", asparent="")
ret += ('(*args).rval().set(ObjectValue(*result));\n'
'return true;\n')
return CGGeneric(ret)
diff --git a/components/script/dom/webidls/Performance.webidl b/components/script/dom/webidls/Performance.webidl
index 77bca4392e7..0e2f7a960d5 100644
--- a/components/script/dom/webidls/Performance.webidl
+++ b/components/script/dom/webidls/Performance.webidl
@@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
- * https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html#sec-window.performance-attribute
+ * https://w3c.github.io/hr-time/#sec-performance
*/
typedef double DOMHighResTimeStamp;
@@ -13,7 +13,7 @@ typedef sequence<PerformanceEntry> PerformanceEntryList;
interface Performance : EventTarget {
DOMHighResTimeStamp now();
readonly attribute DOMHighResTimeStamp timeOrigin;
- // [Default] object toJSON();
+ [Default] object toJSON();
};
// https://w3c.github.io/performance-timeline/#extensions-to-the-performance-interface
diff --git a/components/script/dom/webidls/PerformanceEntry.webidl b/components/script/dom/webidls/PerformanceEntry.webidl
index 23f2f9c155a..5f6fee1cabd 100644
--- a/components/script/dom/webidls/PerformanceEntry.webidl
+++ b/components/script/dom/webidls/PerformanceEntry.webidl
@@ -12,6 +12,5 @@ interface PerformanceEntry {
readonly attribute DOMString entryType;
readonly attribute DOMHighResTimeStamp startTime;
readonly attribute DOMHighResTimeStamp duration;
-
- // [Default] object toJSON();
+ [Default] object toJSON();
};
diff --git a/components/script/dom/webidls/PerformanceNavigation.webidl b/components/script/dom/webidls/PerformanceNavigation.webidl
index 5a1ccba61f1..3e5cba196f6 100644
--- a/components/script/dom/webidls/PerformanceNavigation.webidl
+++ b/components/script/dom/webidls/PerformanceNavigation.webidl
@@ -14,5 +14,5 @@ interface PerformanceNavigation {
const unsigned short TYPE_RESERVED = 255;
readonly attribute unsigned short type;
readonly attribute unsigned short redirectCount;
- // [Default] object toJSON();
+ [Default] object toJSON();
};
diff --git a/components/script/dom/webidls/PerformanceNavigationTiming.webidl b/components/script/dom/webidls/PerformanceNavigationTiming.webidl
index 0d2c808105b..5e369b4eb91 100644
--- a/components/script/dom/webidls/PerformanceNavigationTiming.webidl
+++ b/components/script/dom/webidls/PerformanceNavigationTiming.webidl
@@ -25,7 +25,7 @@ interface PerformanceNavigationTiming : PerformanceResourceTiming {
readonly attribute DOMHighResTimeStamp loadEventEnd;
readonly attribute NavigationType type;
readonly attribute unsigned short redirectCount;
- // [Default] object toJSON();
+ [Default] object toJSON();
/* Servo-only attribute for measuring when the top-level document (not iframes) is complete. */
[Pref="dom.testperf.enabled"]
readonly attribute DOMHighResTimeStamp topLevelDomComplete;
diff --git a/components/script/dom/webidls/PerformanceResourceTiming.webidl b/components/script/dom/webidls/PerformanceResourceTiming.webidl
index acf1682e800..e4f73197a8c 100644
--- a/components/script/dom/webidls/PerformanceResourceTiming.webidl
+++ b/components/script/dom/webidls/PerformanceResourceTiming.webidl
@@ -26,5 +26,5 @@ interface PerformanceResourceTiming : PerformanceEntry {
/// readonly attribute unsigned long long transferSize;
/// readonly attribute unsigned long long encodedBodySize;
/// readonly attribute unsigned long long decodedBodySize;
- // [Default] object toJSON();
+ [Default] object toJSON();
};