readium / readium-js-viewer

👁 ReadiumJS viewer: default web app for Readium.js library
BSD 3-Clause "New" or "Revised" License
553 stars 186 forks source link

Error in console logs: Cannot read property 'idref' when epub is opened in reader #660

Closed hotTea closed 6 years ago

hotTea commented 6 years ago

This issue is a Bug

Expected Behavior

There should be no errors in browser's console of the type "cannot read property 'idref'" I don't know what the impact of the error is, but it wasn't present in readium's older build.

Observed behavior

There are multiple errors of the type below Uncaught TypeError: Cannot read property 'idref' of undefined external_agent_support.js:155 ExternalAgentSupport.updateContentDocument (external_agent_support.js:155) reader_view.js:284

Steps to reproduce

  1. Get the latest code from readium repository
  2. checkout develop branch
  3. Run the command "npm run prepare:all" as needed
  4. Run "npm run http"
  5. Open sample epub - http://127.0.0.1:8080/dev/index_RequireJS_no-optimize.html?epub=..%2Fepub_content%2Fmoby_dick
  6. Open web browser's console and observe the errors mentioned above.

Product

danielweck commented 6 years ago

@JCCR what do you think?

danielweck commented 6 years ago

https://github.com/readium/readium-shared-js/blob/b73ba7a4912de68a9953f11e17b45e1c857b6c2c/js/views/external_agent_support.js#L155

var contentDocument = contentDocuments[spineItem.idref];

danielweck commented 6 years ago

Duplicate of: https://github.com/readium/readium-shared-js/issues/407

Note that we are prioritizing the bugfix, there is a Pull Request that removes the console error: https://github.com/readium/readium-shared-js/pull/409

hotTea commented 6 years ago

Thanks for the quick turnaround !