Auto merge of #7988 - nox:unforgeable, r=jdm

Implement [Unforgeable]

This is mostly stolen from Gecko. As there, we define the unforgeable members
on an object stored in the slots of the prototype object. They are then copied
onto instance objects when they are instantiated. It should be noted that
proxy objects see their unforgeable memebers defined on their expando object.

Unforgeable attributes aren't properly inherited in codegen (in a similar
fashion as getters and setters as filed in #5875) and require to be redefined
in derived interfaces. Fortunately, there are currently no such interfaces.

No unforgeable members can be included into the TestBinding interfaces for good
measure because they are not compatible with setters.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7988)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-12-03 11:03:05 +05:30
commit 20df7fb7c8
11 changed files with 267 additions and 125 deletions

View file

@ -79,7 +79,7 @@ enum DocumentReadyState { "loading", "interactive", "complete" };
// [OverrideBuiltins]
partial /*sealed*/ interface Document {
// resource metadata management
// [PutForwards=href, Unforgeable]
[/*PutForwards=href, */Unforgeable]
readonly attribute Location/*?*/ location;
readonly attribute DOMString domain;
// readonly attribute DOMString referrer;

View file

@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#location
/*[Unforgeable]*/ interface Location {
[Unforgeable] interface Location {
/*stringifier*/ attribute USVString href;
// attribute USVString origin;
attribute USVString protocol;

View file

@ -11,9 +11,9 @@
//[Replaceable] readonly attribute WindowProxy self;
readonly attribute Window window;
[BinaryName="Self_"] readonly attribute Window self;
/*[Unforgeable]*/ readonly attribute Document document;
[Unforgeable] readonly attribute Document document;
// attribute DOMString name;
/*[PutForwards=href, Unforgeable]*/ readonly attribute Location location;
[/*PutForwards=href, */Unforgeable] readonly attribute Location location;
//readonly attribute History history;
//[Replaceable] readonly attribute BarProp locationbar;
//[Replaceable] readonly attribute BarProp menubar;