This project is archived and is in readonly mode.

#942 ✓resolved
Andrew Bredow

Incorrect x-domain detection in IFrame class yields x-domain error

Reported by Andrew Bredow | July 2nd, 2010 @ 10:06 PM | in 1.3.0 rc2 (closed)

There is an error in the initialize method in the IFrame class. The methodology that it is using to detect whether or not the iframe is on the same domain is incorrect, causing Moo to ALWAYS attempt to extend the iframe document if the iframe is on a different domain.

All you need to do to reproduce the error is create instantiate the iframe class with the src set to another domain.

The problem is the onFrameLoad method - "host" ends up being null whenever we aren't able to access the domain.

Without too much testing, a simple fix appears to be:
a) Remove the !host portion of the conditional that contains the iframe extending code.
b) Move the next line ("onload.call(iframe.contentWindow, iframe.contentWindow.document);") into the above conditional. This line also causes an x-domain error.

Comments and changes to this ticket

  • SamGoody

    SamGoody July 5th, 2010 @ 10:30 AM

    • Assigned user set to “Sebastian Markbåge”
    1. The reason that "|| !host" was added was to allow the creation of a vanilla (no-domain) iFrame.
      Removing the !host will just cause a regression.
      Orignal ticket - https://mootools.lighthouseapp.com/projects/2706/tickets/53-native-...

    2. As is, the code is actually crashing when it attempts to provide a unique id to the undefined window returned with iFrame.contentWindow
      Usually, it dies silently at that line.
      In Firefox, this will sometimes - inconsistently - cause a periodic cross domain err, eventually crashing the browser.

    3. Even if the x-domain err does not show, the err is still there and can be easily tested. - the uid is applied and fails by all cross domains.

    4. This is definitely an issue. Took two hours of debugging before I realized what was going on. I suspect this is what issue #879 was about, though the author disapeared after reporting it.

  • Christoph Pojer

    Christoph Pojer September 5th, 2010 @ 01:38 PM

    • Milestone set to 1.3.0 rc2
    • State changed from “new” to “open”
    • Assigned user changed from “Sebastian Markbåge” to “Valerio”
    • Milestone order changed from “779” to “0”
  • Christoph Pojer

    Christoph Pojer September 10th, 2010 @ 06:36 PM

    • State changed from “open” to “resolved”
    • Milestone order changed from “77” to “0”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

Pages