-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from andreadelrio/new-terminal
Bug 1147963 - [Fix] Log viewer (Inspect Task) has very poor UX
- Loading branch information
Showing
4 changed files
with
227 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
module.exports = function (self) { | ||
var request; | ||
var dataOffset = 0; | ||
|
||
function divide(data) { | ||
return data.split('\n'); | ||
} | ||
|
||
function onData(e) { | ||
var resp = {}; | ||
if (request.responseText != null) { | ||
// Check if we have new data | ||
var length = request.responseText.length; | ||
if (length > dataOffset) { | ||
resp.data = divide(request.responseText); | ||
resp.done = false; | ||
} | ||
} | ||
// When request is done | ||
if (request.readyState === request.DONE) { | ||
resp.done = true; | ||
// Write an error, if request failed | ||
if (request.status !== 200) { | ||
resp.data = ["\r\n[task-inspector] Failed to fetch log!\r\n"]; | ||
} else { | ||
resp.data = divide(request.responseText); | ||
} | ||
} | ||
postMessage(resp); | ||
if (resp.done) { | ||
close(); | ||
} | ||
} | ||
|
||
function abort() { | ||
request.removeEventListener('progress', onData); | ||
request.removeEventListener('load', onData); | ||
request.abort(); | ||
close(); | ||
} | ||
|
||
self.addEventListener('message', function(e) { | ||
if (e.data.url) { | ||
request = new XMLHttpRequest(); | ||
request.open('get', e.data.url, true); | ||
request.addEventListener('loadstart', onData); | ||
request.addEventListener('progress', onData); | ||
request.addEventListener('load', onData); | ||
request.send(); | ||
}; | ||
if (e.data.abort) { | ||
abort(); | ||
} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,32 @@ | ||
.viewer { | ||
width: 100%; | ||
} | ||
|
||
.viewer > div { | ||
display: inline-block; | ||
vertical-align: top; | ||
overflow-y: hidden; | ||
} | ||
|
||
.viewer > .buffer { | ||
background-color: black; | ||
width: calc(~'100% - 20px'); | ||
overflow-x: auto; | ||
overflow-y: hidden; | ||
height: 600px; | ||
padding-left: 7px; | ||
} | ||
|
||
.viewer > .buffer > div { | ||
font-family: monospace; | ||
color: white; | ||
margin-bottom: 2px; | ||
margin-top: 2px; | ||
min-height: 1em; | ||
font-size: 0.8em; | ||
} | ||
|
||
.viewer > .scrollbar { | ||
width: 20px; | ||
background-color: #7f7f7f; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters