Skip to content

Firebase js sdk inside of iframe makes desktop safari freezing. #21

@brn

Description

@brn

Describe your environment

  • Operating System version: Mac OSX 10.11.6
  • Firebase SDK version: 4.0.0
  • Firebase Product: auth, database

Describe the problem

We use firebase js sdk inside of an iframe element.
That work for almost case but not work for desktop safari(ver 10.0.2).

Steps to reproduce:

In specific,

    1. Open page and connect firebase database.
    1. Open new tab and open same location of 1
    1. Open new tab repeatedly and safari frozen.

Relevant Code:

<!doctype html>
<html>
  <head>
  </head>
  <body>
    <script>
      const iframe = document.body.appendChild(document.createElement('iframe'));
      iframe.onload = () => {
        const doc = iframe.contentDocument;
        doc.open();
        doc.writeln('<!doctype html>');
        doc.writeln('<head>');
        doc.writeln(`<script src="https://www.gstatic.com/firebasejs/4.0.0/firebase.js"></s` + `cript>`);
        doc.writeln(`<script>firebase.initializeApp({apiKey: "API_KEY",authDomain: "AUTH_DOMAIN",databaseURL: "DATABASE_URL",storageBucket: "BUCKET"});</s` + `cript>`);
        doc.writeln(`<script>firebase.database().ref('DATABASE_URL').on('value', () => {})</s` + `cript>`);
        doc.writeln('</head>');
        doc.writeln('<body>');
        doc.writeln('<a href="https://www.google.com" target="_top">go to google</a>')
        doc.writeln('</body>');
        doc.close();
      }
      iframe.src = 'javascript:false';
    </script>
  </body>
</html>

In above example, link to google is worked expected, but if more than 3 or more tab opened, link to google is not accessible or iframe is disappeared.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions