Skip to content
This repository was archived by the owner on May 7, 2025. It is now read-only.
This repository was archived by the owner on May 7, 2025. It is now read-only.

Is there any reason why navigator.epubReadingSystem is writable?  #452

@JayPanoz

Description

@JayPanoz

This issue is a Question

I just checked the cloud reader and it looks like epubReadingSystem can be entirely changed while it should be read-only, according to the EPUB3 spec.

Related issue(s) and/or pull request(s)

See also #41 I guess, as that may well be one significant reason why.

Expected Behaviour

epubReadingSystem and its properties can’t be modified or removed, properties can’t be added.

Observed behaviour

Instead, the cloud reader lets you do pretty much anything with it.

capture d ecran 2018-08-25 a 14 25 29

Steps to reproduce

  1. check iframe’s navigator.epubReadingSystem
  2. redefine prop e.g. navigator.epubReadingSystem.name = ""
  3. check iframe’s navigator.epubReadingSystem, name is now empty
  4. redefine object e.g. navigator.epubReadingSystem = {}
  5. check iframe’s navigator.epubReadingSystem, it is now {}

To my knowledge, and it’s been tested with another implem, redefining should fail silently (in non-strict mode, and throw a TypeError in strict mode) and checking should return the object and properties unmodified.

Product

  • Readium cloud reader app
    • latest development build uploaded at https://readium.firebaseapp.com OR a custom integration (list public deployment URL, if any)
    • All browsers
    • All platforms

That may well apply to other products, I stopped at the cloud reader.

Additional information

The following is reported to work but issue #41 may beg to differ:

  1. Object.freeze() the epubReadingSystemObject
  2. Object.defineProperty(navigator, "epubReadingSystem", {value: epubReadingSystemObject, writable: false})

Freeze should make the properties unwritable while defineProperty should make the object itself unwritable. That’s ES5 BTW.

But then, there could be other reasons, I just couldn’t find them with a quick search in issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions