1<!doctype html> 2<html lang="en-us"> 3<head> 4 <meta charset="utf-8"> 5 <title>Bigtrace UI</title> 6 <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" /> 7 <link rel="shortcut icon" id="favicon" type="image/png" href="data:image/png;base64,iVBORw0KGgo="> 8</head> 9<body data-perfetto_version='{"filled_by_build_js":"."}'> 10 <!-- 11 Don't add any content here. The whole <body> is replaced by 12 bigtrace/index.ts when bootstrapping. This is only used for very early 13 error reporting. 14 --> 15 <style> 16 #app_load_failure {opacity:0;transition:opacity 1s ease;position:absolute;overflow:auto;background:#080082;top:0;left:0;width:100%;height:100%;bottom:0;right:0;margin:0;opacity:0;user-select:text} 17 #app_load_failure > pre {color:#fff;position:absolute;margin:auto;white-space:pre-wrap;top:10vh;max-width:90vw;width:880px;left:0;right:0;font-size:16px;line-height:30px;font-weight:700} 18 #app_load_failure > pre span {background:#fff;color:#080082;padding:2px} 19 #app_load_failure_dbg { overflow-wrap: break-word; font-size: 12px; line-height: 1; font-weight: initial;} 20 #app_load_failure a {color:#fff} 21 #app_load { position: absolute; top: 0; left: 0; right:0; bottom: 0; background-color: #2c3e50;} 22 #app_load_spinner { margin: 30vh auto; width: 150px; height: 150px; border: 3px solid rgba(255,255,255,.3); border-radius: 50%; border-top-color: #fff; animation: app_load_spin 1s ease-in-out infinite; } 23 @keyframes app_load_spin { to { transform: rotate(360deg); } } 24 </style> 25 <div id="app_load"><div id="app_load_spinner"></div></div> 26 <div id="app_load_failure"> 27<pre> 28<span>Bigtrace UI - An unrecoverable problem occurred</span> 29 30If you are seeing this message, something went wrong while loading the UI. 31Please file a bug (details below) and try these remediation steps: 32 33* Force-reload the page with Ctrl+Shift+R (Mac: Meta+Shift+R) or 34 Shift + click on the refresh button. 35 36* <a href="javascript:clearAllCaches();">Clear all the site storage and caches</a> and reload the page. 37 38* Clear the site data and caches from devtools, following <a target="_blank" href="https://developers.google.com/web/tools/chrome-devtools/storage/cache#deletecache">these instructions</a>. 39 40In any case, **FILE A BUG** attaching logs and screenshots from devtools. 41 Googlers: <a href="http://go/perfetto-ui-bug" target="_blank">go/perfetto-ui-bug</a> 42 Non-googlers: <a href="https://github.com/google/perfetto/issues/new" target="_blank">github.com/google/perfetto/issues/new</a> 43 44<div id=app_load_failure_err></div> 45Technical Information: 46<div id=app_load_failure_dbg></div> 47</pre> 48 </div> 49 <script type="text/javascript"> 50 'use strict'; 51 (function () { 52 const TIMEOUT_MS = 60000; 53 let errTimerId = undefined; 54 55 function errHandler(err) { 56 // Note: we deliberately don't clearTimeout(), which means that this 57 // handler is called also in the happy case when the UI loads. In that 58 // case, though, the onCssLoaded() in frontend/index.ts will empty the 59 // <body>, so |div| below will be null and this function becomes a 60 // no-op. 61 const div = document.getElementById('app_load_failure'); 62 if (!div) return; 63 div.style.opacity ='1'; 64 const errDom = document.getElementById('app_load_failure_err'); 65 if (!errDom) return; 66 console.error(err); 67 errDom.innerText += `${err}\n`; 68 const storageJson = JSON.stringify(window.localStorage); 69 const dbg = document.getElementById('app_load_failure_dbg'); 70 if (!dbg) return; 71 dbg.innerText = `LocalStorage: ${storageJson}\n`; 72 if (errTimerId !== undefined) clearTimeout(errTimerId); 73 } 74 75 // For the 'Click here to clear all caches'. 76 window.clearAllCaches = async () => { 77 if (window.localStorage) window.localStorage.clear(); 78 if (window.sessionStorage) window.sessionStorage.clear(); 79 const promises = []; 80 if (window.caches) { 81 try { 82 const keys = await window.caches.keys(); 83 keys.forEach(k => promises.push(window.caches.delete(k))); 84 } catch (_) { 85 // TODO(288483453) 86 } 87 } 88 if (navigator.serviceWorker) { 89 const regs = await navigator.serviceWorker.getRegistrations(); 90 regs.forEach(reg => promises.push(reg.unregister())); 91 } 92 try { 93 await Promise.all(promises); 94 } catch (_) { 95 // TODO(288483453) 96 } 97 window.location.reload(); 98 } 99 100 // If the frontend doesn't come up, make the error page above visible. 101 errTimerId = setTimeout(() => errHandler('Timed out'), TIMEOUT_MS); 102 window.onerror = errHandler; 103 window.onunhandledrejection = errHandler; 104 105 const versionStr = document.body.dataset['perfetto_version'] || '{}'; 106 const versionMap = JSON.parse(versionStr); 107 const channel = localStorage.getItem('perfettoUiChannel') || 'stable'; 108 109 // The '.' below is a fallback for the case of opening a pinned version 110 // (e.g., ui.perfetto.dev/v1.2.3./). In that case, the index.html has no 111 // valid version map; we want to load the frontend from the same 112 // sub-directory directory, hence ./frontend_bundle.js. 113 const version = versionMap[channel] || versionMap['stable'] || '.'; 114 115 const script = document.createElement('script'); 116 script.async = true; 117 script.src = version + '/bigtrace/bigtrace_bundle.js'; 118 script.onerror = () => errHandler(`Failed to load ${script.src}`); 119 120 document.head.append(script); 121 })(); 122 </script> 123</body> 124</html> 125