Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repair some builtin prototypes in order to tolerate the "override mistake" #188

Closed
warner opened this issue Aug 22, 2018 · 13 comments · Fixed by Agoric/SES#146
Closed

Repair some builtin prototypes in order to tolerate the "override mistake" #188

warner opened this issue Aug 22, 2018 · 13 comments · Fixed by Agoric/SES#146

Comments

@warner
Copy link
Contributor

warner commented Aug 22, 2018

We omitted the tamperProof.js file (to fix the override mistake) when we built SES out of Realms instead of FrozenRealms, we need to pull that in.

@erights
Copy link
Contributor

erights commented Aug 23, 2018

At https://github.com/Agoric/SES/blob/master/src/index.js there is a commented out call to tamperProofDataProperties but the only thing I could find is https://github.com/tc39/proposal-frozen-realms/blob/master/shim/src/mutable.js which is to a much earlier version. Where is the code containing the tamperProofDataProperties we used to call?

@erights
Copy link
Contributor

erights commented Jan 4, 2019

@bmeck @littledan , where is a good place to track this issue? Could you reply with a link? Thanks.

@erights
Copy link
Contributor

erights commented Jan 4, 2019

Sorry. By "this issue" I mean the attempt to fix the override mistake in the EcmaScript spec, which is only distantly related to this issue. Nevertheless, it would be nice to have a link here. Thanks.

@bmeck
Copy link

bmeck commented Jan 4, 2019

tc39/ecma262#1320 is probably the best place currently as it deals w/ the spec changes 1307 can probably closed in lieu of it.

@erights
Copy link
Contributor

erights commented Feb 6, 2019

Hi @jfparadis , did you say that your data suggested we only need this repair on
Object.prototype, Function.prototype, RegExpr.prototype? What about Array.prototype`? Others?

For the prototypes we do repair, which properties should we repair?

@erights erights changed the title fix the "override mistake" Repair some builtin prototypes in order to tolerate the "override mistake" Feb 6, 2019
@jfparadis
Copy link
Contributor

Here is the current list:
Object.prototype
Array.prototype
Function.prototype
Error.prototype

@erights
Copy link
Contributor

erights commented Feb 7, 2019

Thanks.

Do you have any data on which properties on these prototypes could remain unrepaired?

@jfparadis
Copy link
Contributor

All prototype properties of Object and Array need to me repaired because arrays are often used as objects, and any property can be set on objects to allow compatibility.

For the rest, we can only repair Function 'name' and Error 'message'.

@kumavis
Copy link
Member

kumavis commented Aug 26, 2019

found tamperProofDataProperties

After finding the history, I think mutable.js is actually the newer version.

@erights
Copy link
Contributor

erights commented Aug 26, 2019

After finding the history, I think mutable.js is actually the newer version.

Newer than tamper-proof.js, yes. But not the newest. Waiting from responses from @caridy @jdalton @jfparadis @guybedford @bmeck

@bmeck
Copy link

bmeck commented Aug 26, 2019

node is currently using https://github.com/nodejs/node/blob/554ffa34320ebfe62e6eefd4607483866362efd3/lib/internal/freeze_intrinsics.js#L253 but can align with w/e is preferred.

@erights
Copy link
Contributor

erights commented Aug 26, 2019

I like the name enableDerivedOverride. Anyone see what the other differences are?

@manuel-jasso
Copy link

After finding the history, I think mutable.js is actually the newer version.

Newer than tamper-proof.js, yes. But not the newest. Waiting from responses from @caridy @jdalton @jfparadis @guybedford @bmeck

@erights Commenting as requested by @caridy - Salesforce's Locker uses a customized version of mutable.js, with some prototypes commented out:

    [
      i.ObjectPrototype,
      i.ArrayPrototype
      // i.BooleanPrototype,
      // i.DatePrototype,
      // i.NumberPrototype,
      // i.StringPrototype,

      // i.IteratorPrototype,
      // i.ArrayIteratorPrototype,

      // i.PromisePrototype,
      // i.DataViewPrototype,

      // i.TypedArray,
      // i.Int8ArrayPrototype,
      // i.Int16ArrayPrototype,
      // i.Int32ArrayPrototype,
      // i.Uint8Array,
      // i.Uint16Array,
      // i.Uint32Array
    ],

For these prototypes we apply beMutable to the name property only:

    [
      i.FunctionPrototype,
      i.GeneratorPrototype,
      i.AsyncFunctionPrototype,
      i.AsyncGeneratorPrototype
    ],

And for these prototypes we apply beMutable to the message property only:

    [
      i.ErrorPrototype,
      i.EvalErrorPrototype,
      i.RangeErrorPrototype,
      i.ReferenceErrorPrototype,
      i.SyntaxErrorPrototype,
      i.TypeErrorPrototype,
      i.URIErrorPrototype
    ],

@jfparadis jfparadis transferred this issue from Agoric/SES Feb 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants