mozilla / brackets

An open source code editor for the web, written in JavaScript, HTML and CSS.
http://brackets.io
MIT License
176 stars 278 forks source link

Uncaught TypeError: Cannot set property of #<XMLHttpRequest> #321

Closed humphd closed 9 years ago

humphd commented 9 years ago

When I paste the following HTML into Bramble, I get the error below:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Your Awesome Webpage</title>
  </head>
  <body>
    <div id="log"></div>
    <script>
      var httpRequest = new XMLHttpRequest();

      function print(text) {
         document.getElementById('log').innerHTML = text;
      }

      function alertContents() {
        if (httpRequest.readyState === 4) {
          if (httpRequest.status === 200) {
            print(httpRequest.responseText);
          } else {
            print('There was a problem with the request.');
          }
        }
      }

      httpRequest.onreadystatechange = alertContents;
      httpRequest.open('GET', './foo.json');
      httpRequest.send();

    </script>
  </body>
</html>

The console shows the following errors:

Uncaught TypeError: Cannot set property readyState of #<XMLHttpRequest> which has only a getterxhr.send 
@ blob:http%3A//localhost%3A8080/0d4f958c-5d1b-4d69-b487-a81856fe6aa0:215(anonymous function) 
@ blob:http%3A//localhost%3A8080/0d4f958c-5d1b-4d69-b487-a81856fe6aa0:1839
blob:http%3A//localhost%3A8080/0d4f958c-5d1b-4d69-b487-a81856fe6aa0:129

Uncaught TypeError: Cannot set property status of #<XMLHttpRequest> which has only a getterhandleError 
@ blob:http%3A//localhost%3A8080/0d4f958c-5d1b-4d69-b487-a81856fe6aa0:129setResponse 
@ blob:http%3A//localhost%3A8080/0d4f958c-5d1b-4d69-b487-a81856fe6aa0:151(anonymous function) 
@ blob:http%3A//localhost%3A8080/0d4f958c-5d1b-4d69-b487-a81856fe6aa0:206
blob:http%3A//localhost%3A8080/0d4f958c-5d1b-4d69-b487-a81856fe6aa0:340 
[Brackets LiveDev] No subscribers for message XMLHttpRequest
gideonthomas commented 9 years ago

I don't understand -.- This has never come up before. Now its actually throwing errors if we set readonly properties

sedge commented 9 years ago

A git bisect revealed https://github.com/humphd/brackets/commit/630a44f082065dc1135c55a7597f4446771d8fc1 as the culprit.

humphd commented 9 years ago

Could be a browser update and change to rules around modifying native objects and read only properties.

On May 25, 2015 10:12 PM, Gideon Thomas notifications@github.com wrote:

I don't understand -.- This has never come up before. Now its actually throwing errors if we set readonly properties

— Reply to this email directly or view it on GitHubhttps://github.com/humphd/brackets/issues/321#issuecomment-105359786.