This repository was archived by the owner on Mar 13, 2018. It is now read-only.
File tree 5 files changed +45
-0
lines changed
5 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 46
46
" src/wrappers/Window.js" ,
47
47
" src/wrappers/DataTransfer.js" ,
48
48
" src/wrappers/FormData.js" ,
49
+ " src/wrappers/XMLHttpRequest.js" ,
49
50
" src/wrappers/override-constructors.js"
50
51
]
Original file line number Diff line number Diff line change 62
62
'src/wrappers/Window.js' ,
63
63
'src/wrappers/DataTransfer.js' ,
64
64
'src/wrappers/FormData.js' ,
65
+ 'src/wrappers/XMLHttpRequest.js' ,
65
66
'src/wrappers/override-constructors.js'
66
67
] . forEach ( function ( src ) {
67
68
document . write ( '<script src="' + base + src + '"></script>' ) ;
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2014 The Polymer Authors. All rights reserved.
3
+ * Use of this source code is goverened by a BSD-style
4
+ * license that can be found in the LICENSE file.
5
+ */
6
+
7
+ ( function ( scope ) {
8
+ 'use strict' ;
9
+
10
+ var unwrapIfNeeded = scope . unwrapIfNeeded ;
11
+ var originalSend = XMLHttpRequest . prototype . send ;
12
+
13
+ // Since we only need to adjust XHR.send, we just patch it instead of wrapping
14
+ // the entire object. This happens when FormData is passed.
15
+ XMLHttpRequest . prototype . send = function ( obj ) {
16
+ return originalSend . call ( this , unwrapIfNeeded ( obj ) ) ;
17
+ } ;
18
+
19
+ } ) ( window . ShadowDOMPolyfill ) ;
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2014 The Polymer Authors. All rights reserved.
3
+ * Use of this source code is goverened by a BSD-style
4
+ * license that can be found in the LICENSE file.
5
+ */
6
+
7
+ suite ( 'XMLHttpRequest' , function ( ) {
8
+
9
+ var wrap = ShadowDOMPolyfill . wrap ;
10
+ var unwrap = ShadowDOMPolyfill . unwrap ;
11
+
12
+ test ( 'instanceof' , function ( ) {
13
+ var xhr = new XMLHttpRequest ( ) ;
14
+ assert . instanceOf ( xhr , XMLHttpRequest ) ;
15
+ } ) ;
16
+
17
+ test ( 'send' , function ( ) {
18
+ var xhr = new XMLHttpRequest ( ) ;
19
+ xhr . open ( 'POST' , location . href ) ;
20
+ xhr . send ( new FormData ( ) ) ;
21
+ } ) ;
22
+
23
+ } ) ;
Original file line number Diff line number Diff line change @@ -124,6 +124,7 @@ var modules = [
124
124
'TouchEvent.js' ,
125
125
'TreeScope.js' ,
126
126
'Window.js' ,
127
+ 'XMLHttpRequest.js' ,
127
128
'build-json.js' ,
128
129
'createTable.js' ,
129
130
'custom-element.js' ,
You can’t perform that action at this time.
0 commit comments