Bug Tracker

Opened 6 years ago

Closed 6 years ago

#14405 closed bug (duplicate)

jQuery.ajax behaves differently when solve the sourceMappingURL

Reported by: jeffrey.zksun@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:

Description

I use jQuery.ajax to load the javascript file cross domain. The script code are as below. There is only one difference between test1.html and test2.html. In test1.html, the dataType is set to be 'script', but not in test2.html. If the dataType is not specified, it will infers from the MIME type. For the test2.html, the inferred dataType is also 'script'.

In Test1.html, the chrome devTools tries to load source map from http://code.angularjs.org/1.2.0rc1/angular.min.js.map. But in Tet2.html, it tries to load the source map from http://local.host:8081/web/angular.min.js.map, which is incorrect. This is the defect.

In my test code, the only difference is specifying the dataType or inferring it. So it seems like a jQuery defect, which affect the solved path of the source mapping url. More details are post here: stackoverflow.com/questions/19079171/jquery-ajax-behaves-differently-when-solve-the-sourcemappingurl

Test1.html

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script> $.ajax({

url: "http://code.angularjs.org/1.2.0rc1/angular.min.js", type: "GET", dataType: "script", success: function(){

if(typeof angular !== undefined )console.log('evaluated'); else console.log('not evaluated'); },

error: function(){ console.log('failure')}

});

</script>

Test2.html

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script> $.ajax({

url: "http://code.angularjs.org/1.2.0rc1/angular.min.js", type: "GET", success: function(){

if(typeof angular !== undefined )console.log('evaluated'); else console.log('not evaluated'); },

error: function(){ console.log('failure')} });

</script>

Change History (1)

comment:1 Changed 6 years ago by dmethvin

Resolution: duplicate
Status: newclosed

Duplicate of #14404.

Note: See TracTickets for help on using tickets.