Skip to content

Commit

Permalink
Throw on trying to open blacklisted methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dmp42 committed Jul 5, 2012
1 parent 14eeae6 commit bbb269d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions XMLHttpRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@

// Public Methods
cXMLHttpRequest.prototype.open = function(sMethod, sUrl, bAsync, sUser, sPassword) {
// http://www.w3.org/TR/XMLHttpRequest/#the-open-method
var backlist = sMethod.toLowerCase();
if((backlist == "connect") || (backlist == "trace") || (backlist == "track")){
// Using a generic error and an int - not too sure all browsers support correctly
// http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#securityerror, so, this is safer
// XXX should do better than that, but this is OT to XHR.
throw new Error(18);
}

// Delete headers, required when object is reused
delete this._headers;

Expand Down

0 comments on commit bbb269d

Please sign in to comment.