~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/filesystem/browser/media/browser.js

  • Committer: David Coles
  • Date: 2010-05-31 15:15:21 UTC
  • Revision ID: coles.david@gmail.com-20100531151521-20e9d7r1gbcziep1
Use innerText || innerContent to get contents of iframe. Should prevent an odd 
bug where the browser creates multiple text nodes that causes us to read 
truncated JSON.

Show diffs side-by-side

added added

removed removed

Lines of Context:
398
398
        /* Browsers will turn the raw returned JSON into an HTML document. We
399
399
         * need to get the <pre> from inside the <body>, and look at its text.
400
400
         */
401
 
        data = myFrame.firstChild.getElementsByTagName(
402
 
            'body')[0].firstChild.firstChild.nodeValue;
 
401
        var pre = myFrame.firstChild.getElementsByTagName(
 
402
            'body')[0].firstChild;
 
403
        var data = pre.innerText || pre.textContent;
403
404
        data = JSON.parse(data);
404
405
        if ('Error' in data)
405
406
            alert("Error: " + decodeURIComponent(data['Error']));