1function deliverResponseOntoPort( workerPort, status, data ) { 2 workerPort.postMessage({ 3 workerFinalStatus: status, 4 workerFinalData: data 5 }); 6} 7 8function loadProducts( workerPort, productsUrl ) { 9 var xhr = new XMLHttpRequest(); 10 11 xhr.onload = function() { 12 var products = null; 13 14 try { 15 products = JSON.parse( xhr.responseText ); 16 } catch (error) { 17 deliverResponseOntoPort( workerPort, 500 ); 18 19 return; 20 } 21 22 deliverResponseOntoPort( workerPort, 200, products ); 23 }; 24 25 xhr.onerror = function(e) { 26 deliverResponseOntoPort( workerPort, xhr.status ); 27 }; 28 29 xhr.open('GET', productsUrl, true); 30 31 xhr.send(); 32} 33 34onconnect = function(e) { 35 var port = e.ports[0]; 36 37 port.onmessage = function(e) { 38 var productsUrl = e.data.requestUrl; 39 40 if ( e.data.reason == 'doRequest' ) { 41 loadProducts( port, productsUrl ); 42 } 43 }; 44};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.