зеркало из https://github.com/mozilla/gecko-dev.git
Bug 872377 - Restore "toJSON" to list of reserved webidl keywords. r=bz
This patch makes toJSON a reserved webidl keyword, and changes the implementation of mozRTCSessionDescription to use a jsonifier.
This commit is contained in:
Родитель
e5c50c21e1
Коммит
6e0cc6d805
|
@ -320,8 +320,8 @@ class IDLUnresolvedIdentifier(IDLObject):
|
|||
[location])
|
||||
if name[0] == '_' and not allowDoubleUnderscore:
|
||||
name = name[1:]
|
||||
# TODO: Bug 872377, Restore "toJSON" to below list.
|
||||
if name in ["constructor", "iterator", "toString"] and not allowForbidden:
|
||||
if (name in ["constructor", "iterator", "toString", "toJSON"] and
|
||||
not allowForbidden):
|
||||
raise WebIDLError("Cannot use reserved identifier '%s'" % (name),
|
||||
[location])
|
||||
|
||||
|
|
|
@ -153,12 +153,6 @@ RTCSessionDescription.prototype = {
|
|||
__init: function(dict) {
|
||||
this.type = dict.type;
|
||||
this.sdp = dict.sdp;
|
||||
},
|
||||
|
||||
// Bug 863402 serializer support workaround
|
||||
toJSON: function() {
|
||||
return { type: this.type, sdp: this.sdp,
|
||||
__exposedProps__: { type: "rw", sdp: "rw" } };
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ MOCHITEST_FILES = \
|
|||
test_peerConnection_bug827843.html \
|
||||
test_peerConnection_bug834153.html \
|
||||
test_peerConnection_bug835370.html \
|
||||
test_peerConnection_toJSON.html \
|
||||
head.js \
|
||||
mediaStreamPlayback.js \
|
||||
pc.js \
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=872377
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 872377</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 872377 **/
|
||||
|
||||
var rtcSession = new mozRTCSessionDescription({ sdp: "Picklechips!",
|
||||
type: "offer" });
|
||||
var jsonCopy = JSON.parse(JSON.stringify(rtcSession));
|
||||
for (key in rtcSession) {
|
||||
if (typeof(rtcSession[key]) == "function") continue;
|
||||
is(rtcSession[key], jsonCopy[key], "key " + key + " should match.");
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=872377">Mozilla Bug 872377</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -25,7 +25,5 @@ interface mozRTCSessionDescription {
|
|||
attribute RTCSdpType? type;
|
||||
attribute DOMString? sdp;
|
||||
|
||||
// Bug 863402 serializer support workaround
|
||||
//serializer = {attribute};
|
||||
object toJSON();
|
||||
jsonifier;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче