nextcloud / nextcloud/richdocuments
Crash when nextcloud is inside an iframe
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 453
- Forks
- 147
- Avg merge
- 14h 54m
- Merged PRs (30d)
- 83
Description
Describe the bug
When Nextcloud is inside an iframe, the new code for a dark interface crashes the richdocuments app.
To Reproduce
Steps to reproduce the behavior:
- Have nextcloud in an iframe
- Open a richdocument file
Expected behavior
The document should open
Client details:
- OS: archlinux
- Browser firefox
- Version: 118.0
- Device: desktop
Server details
Operating system: Debian 11
Web server: Apache
Database: Mysql
PHP version: 8.2
Nextcloud version: 27.1.1
Version of the richdocuments app 8.2
Version of Collabora Online 22.05.12.2
The call to "parent.document.body.dataset" inside "src/helpers/coolParameters.js" (lines 35 and 36) causes an error because I think the code is trying to access the site containing the iframe and not nextcloud. There should be a way to access the parent just above and not the root site. I don't know if this is possible? But by setting the 2 variables nextcloudDarkMode and matchedDarkMode to false, it works again.
Browser log
The javascript console log :
Permission denied to access property "document" on cross-origin object
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/helpers/coolParameters.js, especially lines 35-36 where parent.document.body.dataset is accessed. Reproduce by opening a richdocument while Nextcloud is embedded in a cross-origin iframe, then inspect the browser console for the permission error. Done means the document opens without the iframe-related crash.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100