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

Any book opened just shows a blank page, contents don't load with "TypeError: location is undefined" error #1438

Open
ell1e opened this issue Nov 26, 2024 · 18 comments
Labels
bug Something isn't working

Comments

@ell1e
Copy link

ell1e commented Nov 26, 2024

Describe the bug
Any book opened just shows a blank page, the contents don't seem to ever load:

Screenshot_20241126_172522

To Reproduce
Steps to reproduce the behavior:

  1. Install foliate from flathub: flatpak install flathub com.github.johnfactotum.Foliate
  2. Open any e-book with foliate

Expected behavior
E-Book opens up fully, page contents show up. This doesn't seem to be the case, the content area remains blank. The close button for the entire window seems to be missing as well.

Screenshots
See above

Version:

  • Foliate version: 3.1.1 from Flathub
  • OS/Distribution and version: postmarketOS
  • Desktop environment: KDE Plasma 6 (Wayland)
  • Installation method: flathub

Additional context

@ell1e ell1e added the bug Something isn't working label Nov 26, 2024
@ell1e
Copy link
Author

ell1e commented Nov 28, 2024

I noticed it outputs an error when launching it via terminal:

$ flatpak run com.github.johnfactotum.Foliate

(com.github.johnfactotum.Foliate:2): com.github.johnfactotum.Foliate-WARNING **: 05:22:27.947: Gio.DBusError: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.portal.Tracker was not provided by any .service files
getURIFromTracker@resource:///com/github/johnfactotum/Foliate/library.js:83:60
get@resource:///com/github/johnfactotum/Foliate/library.js:121:42
getBookFromIdentifier@resource:///com/github/johnfactotum/Foliate/library.js:169:36
getBook@resource:///com/github/johnfactotum/Foliate/library.js:166:21
activate@resource:///com/github/johnfactotum/Foliate/library.js:860:63
activate@resource:///com/github/johnfactotum/Foliate/library.js:386:18
_init/GLib.MainLoop.prototype.runAsync/</<@resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266:34
  

(com.github.johnfactotum.Foliate:2): Gjs-CRITICAL **: 05:22:32.688: JS ERROR: TypeError: this[#data] is undefined
vfunc_unroot@resource:///com/github/johnfactotum/Foliate/book-viewer.js:995:9
showLibrary@resource:///com/github/johnfactotum/Foliate/app.js:174:25
addMethods/</<@resource:///com/github/johnfactotum/Foliate/utils.js:281:58
_init/GLib.MainLoop.prototype.runAsync/</<@resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266:34


(com.github.johnfactotum.Foliate:2): com.github.johnfactotum.Foliate-CRITICAL **: 05:22:50.249: TypeError: location is undefined
update@resource:///com/github/johnfactotum/Foliate/annotations.js:156:25
updateBookmarks@resource:///com/github/johnfactotum/Foliate/book-viewer.js:774:37
#onBookReady@resource:///com/github/johnfactotum/Foliate/book-viewer.js:781:13
async*book-ready@resource:///com/github/johnfactotum/Foliate/book-viewer.js:468:54
@resource:///com/github/johnfactotum/Foliate/book-viewer.js:223:23
registerHandler/<@resource:///com/github/johnfactotum/Foliate/webview.js:176:25
_init/GLib.MainLoop.prototype.runAsync/</<@resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266:34

@johnfactotum
Copy link
Owner

johnfactotum commented Nov 28, 2024

Does the table of contents work? If so it's probably because you've previously opened a different book with the same unique identifier and now it's trying to restore the last location but fails.

@ell1e
Copy link
Author

ell1e commented Nov 28, 2024

This happens no matter which book I open, I have dozens to try. The table of contents does show up, see above screenshot, but clicking any entry doesn't result in a visible change.

@johnfactotum
Copy link
Owner

Well, it's possible for dozens of books to have the same unique identifier.

Even if that is not the issue, it seems unlikely that all books fail to open with that error. It's most likely either the kind of issue that I've described, or it would be some other bug specific to the books.

The situation where truly all books fail to load would most likely be an issue with the WebView itself. If OPDS works, though, then it would almost certainly not be a WebView issue.

@ell1e
Copy link
Author

ell1e commented Nov 28, 2024

Is this identifier something inside the epub files, like the ISBN? They are from different publishers so I'm not sure why they would share any identifiers.

Here's the additional error messages that come up when I click any table of contents entry:

~ $ flatpak run com.github.johnfactotum.Foliate

(com.github.johnfactotum.Foliate:2): com.github.johnfactotum.Foliate-CRITICAL **: 05:58:13.051: TypeError: location is undefined
update@resource:///com/github/johnfactotum/Foliate/annotations.js:156:25
updateBookmarks@resource:///com/github/johnfactotum/Foliate/book-viewer.js:774:37
#onBookReady@resource:///com/github/johnfactotum/Foliate/book-viewer.js:781:13
async*book-ready@resource:///com/github/johnfactotum/Foliate/book-viewer.js:468:54
@resource:///com/github/johnfactotum/Foliate/book-viewer.js:223:23
registerHandler/<@resource:///com/github/johnfactotum/Foliate/webview.js:176:25
_init/GLib.MainLoop.prototype.runAsync/</<@resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266:34
  
foliate:///reader/reader.js:424:29: CONSOLE JS ERROR TypeError: undefined is not an object (evaluating 'heads.at(-1).innerText = tocItem?.label ?? ''')
foliate:///reader/reader.js:424:29: CONSOLE JS ERROR TypeError: undefined is not an object (evaluating 'heads.at(-1).innerText = tocItem?.label ?? ''')
foliate:///reader/reader.js:424:29: CONSOLE JS ERROR TypeError: undefined is not an object (evaluating 'heads.at(-1).innerText = tocItem?.label ?? ''')
foliate:///reader/reader.js:424:29: CONSOLE JS ERROR TypeError: undefined is not an object (evaluating 'heads.at(-1).innerText = tocItem?.label ?? ''')
foliate:///reader/reader.js:424:29: CONSOLE JS ERROR TypeError: undefined is not an object (evaluating 'heads.at(-1).innerText = tocItem?.label ?? ''')
foliate:///reader/reader.js:424:29: CONSOLE JS ERROR TypeError: undefined is not an object (evaluating 'heads.at(-1).innerText = tocItem?.label ?? ''')
foliate:///reader/reader.js:424:29: CONSOLE JS ERROR TypeError: undefined is not an object (evaluating 'heads.at(-1).innerText = tocItem?.label ?? ''')
foliate:///reader/reader.js:424:29: CONSOLE JS ERROR TypeError: undefined is not an object (evaluating 'heads.at(-1).innerText = tocItem?.label ?? ''')

The chapters in the table of contents look correct, so I'm assuming that means it has full filesystem access to the underlying book file or else I wouldn't know how it could possibly list the chapters.

@johnfactotum
Copy link
Owner

Some conversion tools would always output the same identifier, or have some other quirks. Anyway, you could check the identifier by clicking on the "About This Book" button (the one next to the title and author of the book on the sidebar, or Ctrl+I).

It could also be some other issue with the books themselves. You can perhaps try opening them in https://johnfactotum.github.io/foliate-js/reader.html. If that doesn't work, that would mean that there's some issue with rendering the books themselves.

@ell1e
Copy link
Author

ell1e commented Nov 28, 2024

  1. I tried multiple in https://johnfactotum.github.io/foliate-js/reader.html and all of them work fine.

  2. I collected some "Identifiers" of books I tried: Twilight by Stephenie Meyer, 2d985536-9857-4e8c-8d00-c4cf50f4e639. Shatter Me by Tahereh Mafi, 9781780318684. Carve the Mark by Veronica Roth, 9d69a1d6-22ca-459b-bfda-5a9545890e24. It doesn't really look to me like the identifiers look suspiciously similar, but perhaps I'm checking the wrong field.

I hope some of that information is useful. Let me know if there's something else that might be worth poking.

@johnfactotum
Copy link
Owner

johnfactotum commented Nov 28, 2024

Well, you could try removing everything in ~/.var/app/com.github.johnfactotum.Foliate/data/com.github.johnfactotum.Foliate. This will clear all reading data, including annotations and bookmarks. This should rule out the case where it's using data from another book.

The you might try opening books from Standard Ebooks or Project Gutenberg. This would rule out that it's an issue specific to the books you have.

@ell1e
Copy link
Author

ell1e commented Nov 28, 2024

I deleted ~/.var/app/com.github.johnfactotum.Foliate/data/com.github.johnfactotum.Foliate and then verified this worked by launching Foliate without clicking on a book (just standalone), and it didn't list my previously opened books anymore. So it seems like the data wipe may have been applied. However, when opening any book, the content area remains blank as before.

Then I tested https://standardebooks.org/ebooks/georgette-heyer/these-old-shades/download?format=epub and the content area remains blank as with the others. In the terminal, I see the same error (com.github.johnfactotum.Foliate:2): com.github.johnfactotum.Foliate-CRITICAL **: 06:39:57.077: TypeError: location is undefined as before.

@ofaws
Copy link

ofaws commented Nov 28, 2024

I have the same issue like the author - no matter what book I try to open I get this error:
image

System: Ubuntu Core 22
Desktop: ubuntu:GNOME
Session: ubuntu (x11)
Language: ru_UA.UTF-8

Versions:

  • Foliate 3.2.0
  • GJS 1.76.02
  • GTK 4.12.3
  • Adwaita 1.4.0
  • GLib 2.78.1
  • WebKitGTK 2.42.0

User directories:

  • /home/olga/snap/foliate/1935/.local/share
  • /home/olga/snap/foliate/common/.cache

Other readers open the books well. The issue appeared yesterday, after the update was installed by snap.
I have already tried to reinstall teh app - but no luck, the issue is still there.

It is sad that Foliate is no longer working, I liked it the most among all ebooks readers

@johnfactotum
Copy link
Owner

@ofaws That looks like a completely different issue. It's probably because the WebKitGTK packaged for the Snap is too old. I will roll back the Snap package for now.

@johnfactotum
Copy link
Owner

@ell1e I must say I'm a bit at a loss. Does the "Next" button work? The last button on the navbar (which shows on tap or hover on the bottom of the book area). If it does work, then the issue must be that it's still loading incorrect last location data from somewhere, though I'm not sure how. If that doesn't work, it would be an even more mysterious issue...

@ell1e ell1e changed the title Any book opened just shows a blank page, contents don't load Any book opened just shows a blank page, contents don't load with "TypeError: location is undefined" error Nov 28, 2024
@ell1e
Copy link
Author

ell1e commented Nov 28, 2024

When I click next nothing happens, the long progress slider doesn't move either:

Screenshot_20241128_150602

The zoom buttons seem to be confused as well:

Screenshot_20241128_150610

@johnfactotum
Copy link
Owner

johnfactotum commented Nov 29, 2024

Huh. The zoom level is displayed as "NaN%", but I believe the number comes straight from the WebView's zoom-level property (it's formatted correctly with "%" so that means the property itself is likely null or undefined). So I suppose this is an issue of the WebView after all and probably not our bug. But do other WebKitGTK WebViews work for you? For example the online OPDS catalogs in Foliate. Or do other apps like Epiphany (GNOME Web) work?

@ell1e
Copy link
Author

ell1e commented Nov 29, 2024

I just installed and tested Epiphany Gnome Web, and it worked fine. But I'm using Foliate inside flatpak, so the GTK webview in there might be a slightly different version. But there doesn't seem to be some general issue with running a GTK webview on this system.

@ofaws
Copy link

ofaws commented Nov 29, 2024

@ofaws That looks like a completely different issue. It's probably because the WebKitGTK packaged for the Snap is too old. I will roll back the Snap package for now.

Thanks for the quick action! App started to work well again after the update =)

@johnfactotum
Copy link
Owner

It's certainly a strange issue. Maybe try

  • Checking whether OPDS catalogs are working. You can do this by clicking on the catalogs on the sidebar of the library view.
  • In the book view, use the inspector, if it works, (F12; or from the view menu) and poke around, see what sort of state things are in. One can use the console and inspect the reader object, or run things like await (await fetch(await reader.book.sections[0].load())).text(), which will fetch the first section, or await reader.view.goTo(0), etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants