extensions/wtf-injector-chrome/popup.js
function openFileClicked() {
  var inputElement = document.createElement('input');
  inputElement['type'] = 'file';
  inputElement['multiple'] = true;
  inputElement['accept'] = [
    '.wtf-trace,application/x-extension-wtf-trace',
    '.wtf-json,application/x-extension-wtf-json',
    '.wtf-calls,application/x-extension-wtf-calls',
    '.cpuprofile,application/x-extension-cpuprofile',
    '.part,application/x-extension-part'
  ].join(',');
  inputElement.onchange = function(e) {
    _gaq.push(['_trackEvent', 'popup', 'open_file']);

    var fileEntries = [];
    for (var n = 0; n < inputElement.files.length; n++) {
      var file = inputElement.files[n];
      var blob = new Blob([file], {
        type: 'application/octet-stream'
      });
      var blobUrl = URL.createObjectURL(blob);
      fileEntries.push({
        name: file.name,
        url: blobUrl,
        size: blob.size
      });
    }

    port.postMessage({
      command: 'show_files',
      files: fileEntries
    });
    window.close();
  };
  inputElement.click();
}
function openFileClicked() {
  var inputElement = document.createElement('input');
  inputElement['type'] = 'file';
  inputElement['multiple'] = true;
  inputElement['accept'] = [
    '.wtf-trace,application/x-extension-wtf-trace',
    '.wtf-json,application/x-extension-wtf-json',
    '.wtf-calls,application/x-extension-wtf-calls',
    '.cpuprofile,application/x-extension-cpuprofile',
    '.part,application/x-extension-part'
  ].join(',');
  inputElement.onchange = function(e) {
    _gaq.push(['_trackEvent', 'popup', 'open_file']);

    var fileEntries = [];
    for (var n = 0; n < inputElement.files.length; n++) {
      var file = inputElement.files[n];
      var blob = new Blob([file], {
        type: 'application/octet-stream'
      });
      var blobUrl = URL.createObjectURL(blob);
      fileEntries.push({
        name: file.name,
        url: blobUrl,
        size: blob.size
      });
    }

    port.postMessage({
      command: 'show_files',
      files: fileEntries
    });
    window.close();
  };
  inputElement.click();
}
function openFileClicked ( ) { var inputElement = document . createElement ( 'input' ) ; inputElement [ 'type' ] = 'file' ; inputElement [ 'multiple' ] = true ; inputElement [ 'accept' ] = [ '.wtf-trace,application/x-extension-wtf-trace' , '.wtf-json,application/x-extension-wtf-json' , '.wtf-calls,application/x-extension-wtf-calls' , '.cpuprofile,application/x-extension-cpuprofile' , '.part,application/x-extension-part' ] . join ( ',' ) ; inputElement . onchange = function ( e ) { _gaq . push ( [ '_trackEvent' , 'popup' , 'open_file' ] ) ; var fileEntries = [ ] ; for ( var n = 0 ; n < inputElement . files . length ; n ++ ) { var file = inputElement . files [ n ] ; var blob = new Blob ( [ file ] , { type : 'application/octet-stream' } ) ; var blobUrl = URL . createObjectURL ( blob ) ; fileEntries . push ( { name : file . name , url : blobUrl , size : blob . size } ) ; } port . postMessage ( { command : 'show_files' , files : fileEntries } ) ; window . close ( ) ; } ; inputElement . click ( ) ; }
Shows the UI and brings up the open file dialog.
Shows the UI and brings up the open file dialog .