@@ -25,8 +25,9 @@ var self = require("sdk/self");
2525var tabs = require ( "sdk/tabs" ) ;
2626var workers = require ( "sdk/content/worker" ) ;
2727var ss = require ( "sdk/simple-storage" ) ;
28- var sniff_panel = null ;
28+ const { XMLHttpRequest } = require ( "sdk/net/xhr" ) ;
2929
30+ var sniff_panel = null ;
3031
3132
3233var button = ToggleButton ( {
@@ -100,8 +101,8 @@ function createSniffPanel()
100101 width : 680 ,
101102 height : 600 ,
102103 contentURL : "./panel_ff.html" , // the same : self.data.url("panel.html"),
103- contentScriptFile : [ "./lib/jquery-1.11.3 .min.js" ,
104- "./lib/jquery-migrate-1.2.1 .min.js" ,
104+ contentScriptFile : [ "./lib/jquery-3.1.0 .min.js" ,
105+ "./lib/jquery-migrate-3.0.0 .min.js" ,
105106 "./lib/jquery-ui.min.js" ,
106107 "./lib/microdatajs/jquery.microdata.js" ,
107108 "./lib/microdatajs/jquery.microdata.json.js" ,
@@ -115,6 +116,8 @@ function createSniffPanel()
115116 "./browser_ff.js" ,
116117 "./settings.js" ,
117118 "./handlers.js" ,
119+ "./converters.js" ,
120+ "./ttl_gen.js" ,
118121 "./html_gen.js" ,
119122 "./panel.js"
120123 ] ,
@@ -168,9 +171,9 @@ function createHandlerPanel(_uri, _type)
168171 var htab = tabs . open ( {
169172 url : "./page_panel_ff.html" ,
170173 onReady : function ( tab ) {
171- tab . attach ( {
172- contentScriptFile : [ "./lib/jquery-1.11.3 .min.js" ,
173- "./lib/jquery-migrate-1.2.1 .min.js" ,
174+ tab . _handler_worker = tab . attach ( {
175+ contentScriptFile : [ "./lib/jquery-3.1.0 .min.js" ,
176+ "./lib/jquery-migrate-3.0.0 .min.js" ,
174177 "./lib/jquery-ui.min.js" ,
175178 "./lib/microdatajs/jquery.microdata.js" ,
176179 "./lib/microdatajs/jquery.microdata.json.js" ,
@@ -185,23 +188,50 @@ function createHandlerPanel(_uri, _type)
185188 "./settings.js" ,
186189 "./page_panel.js" ,
187190 "./handlers.js" ,
191+ "./converters.js" ,
192+ "./ttl_gen.js" ,
188193 "./html_gen.js"
189194 ] ,
190195 contentScriptOptions : { ver : self . version ,
191196 url : _uri ,
192197 type : _type }
193198 } ) ;
199+
200+
201+ tab . _handler_worker . port . on ( "load_data" , function ( msg ) {
202+ if ( msg . url ) {
203+
204+ var xhr = new XMLHttpRequest ( ) ;
205+
206+ xhr . onreadystatechange = function ( ) {
207+ if ( xhr . readyState == 4 ) {
208+ if ( xhr . status === 200 )
209+ tab . _handler_worker . port . emit ( "url_data" , xhr . responseText ) ;
210+ else
211+ {
212+ tab . _handler_worker . port . emit ( "url_error" , "error" ) ;
213+ }
214+ }
215+ }
216+ xhr . open ( 'GET' , msg . url , true ) ;
217+ xhr . setRequestHeader ( 'Accept' , 'text/plain, */*' ) ;
218+ xhr . send ( null ) ;
219+ }
220+ } ) ;
221+
194222 }
195223 } ) ;
224+
225+
196226}
197227
198228
199229
200230
201231tabs . on ( 'load' , function ( tab ) {
202232 var worker = tab . attach ( {
203- contentScriptFile : [ "./lib/jquery-1.11.3 .min.js" ,
204- "./lib/jquery-migrate-1.2.1 .min.js" ,
233+ contentScriptFile : [ "./lib/jquery-3.1.0 .min.js" ,
234+ "./lib/jquery-migrate-3.0.0 .min.js" ,
205235 "./lib/jsonld.js" ,
206236 "./lib/microdatajs/jquery.microdata.js" ,
207237 "./lib/microdatajs/jquery.microdata.json.js" ,
@@ -245,8 +275,8 @@ function createPrefPanel()
245275 width : 570 ,
246276 height : 710 ,
247277 contentURL : "./options_ff.html" ,
248- contentScriptFile : [ "./lib/jquery-1.11.3 .min.js" ,
249- "./lib/jquery-migrate-1.2.1 .min.js" ,
278+ contentScriptFile : [ "./lib/jquery-3.1.0 .min.js" ,
279+ "./lib/jquery-migrate-3.0.0 .min.js" ,
250280 "./lib/jquery-ui.min.js" ,
251281 "./lib/jsuri.js" ,
252282 "./browser_ff.js" ,
@@ -285,7 +315,6 @@ function check_XHR(request)
285315 catch ( exc )
286316 {
287317 }
288-
289318 return false ;
290319}
291320
0 commit comments