nextcloud / nextcloud/richdocuments

Crash when nextcloud is inside an iframe

Open
#3,209 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop bug good first issue
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:

  1. Have nextcloud in an iframe
  2. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.