Closed
Bug 831623
Opened 12 years ago
Closed 12 years ago
Move handleSymbolResponse and fetchSymbol to a new class so it can be used for late write stacks too
Categories
(Toolkit :: Telemetry, defect)
Tracking
()
RESOLVED
FIXED
mozilla21
People
(Reporter: espindola, Assigned: espindola)
References
Details
Attachments
(1 file, 2 obsolete files)
5.07 KB,
patch
|
vladan
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Attachment #703137 -
Flags: review?(vdjeric)
Comment 1•12 years ago
|
||
Comment on attachment 703137 [details] [diff] [review]
patch
>+ <a id="hang-fetch-symbols" href="javascript:">&aboutTelemetry.fetchSymbols;</a>
>+ <a id="hang-hide-symbols" class="hidden" href="javascript:">&aboutTelemetry.hideSymbols;</a>
Nit: fetch-hang-symbols & fetch-hide-symbols.. otherwise it reads like we're hanging something :)
---
I do understand your argument against unnecessary use of singletons but I think this is one case where an object-oriented approach (not a singleton) would make the code more readable. The code as you've refactored it right now is idiosyncratic: there's a global function handleSymbolResponse that references this.fetchElement and calls this.renderHeader. Late-writes and chrome-hangs will be duplicating code for creating an XMLHttpRequest object and setting its arguments (e.g. request type, Content-length, etc.) + you're essentially declaring a class inside ChromeHangs_fetchSymbols with "let request = {};"
Can you create a top level SymbolicationRequest class using "function/.prototype" and have it encapsulate the functionality of sending a request, receiving the response and calling the "render" method on the appropriate singleton? Then LateWrites and ChromeHangs singletons can just do:
let request = new SymbolicationRequest(requestJSON, ChromeHangs);
request.send();
Attachment #703137 -
Flags: review?(vdjeric) → review-
Assignee | ||
Updated•12 years ago
|
Summary: Generalize handleSymbolResponse so it can be used for late write stacks too → Move handleSymbolResponse and fetchSymbol to a new class so it can be used for late write stacks too
Assignee | ||
Comment 2•12 years ago
|
||
I have tested that symbolication works on the mac. It is building on windows and I will test it tomorrow.
Attachment #703761 -
Flags: review?(vdjeric)
Assignee | ||
Updated•12 years ago
|
Attachment #703137 -
Attachment is obsolete: true
Comment 3•12 years ago
|
||
Patch looks good, although I want to take another look in the morning.
What do you think of checking symbolRequest.readyState and symbolRequest.status in SymbolicationRequest.handleSymbolResponse?
Then handleSymbolResponse would either 1) return immediately (if readyState != 4), 2) call StackRenderer.renderSymbolicatedStacks (if status = 200), or 3) call StackRenderer.showErrorMessage (if status != 200).
That way all XMLHttpRequest logic is in SymbolicationRequest and StackRenderer just renders stuff it's told to render.
Assignee | ||
Comment 4•12 years ago
|
||
The hang code was missing an 's' (hang instead of hangs). That is the only difference is this patch.
There is only one call to renderSymbolicatedStacks, so we can inline as much of it as you want without duplicating code, but we should probably do it in a followup bug.
Attachment #703761 -
Attachment is obsolete: true
Attachment #703761 -
Flags: review?(vdjeric)
Attachment #703871 -
Flags: review?(vdjeric)
Updated•12 years ago
|
Attachment #703871 -
Flags: review?(vdjeric) → review+
Comment 5•12 years ago
|
||
Filed bug 832693 for the SymoblicationRequest change
Comment 6•12 years ago
|
||
Rafael is on vacation, so I landed this patch:
https://hg.mozilla.org/integration/mozilla-inbound/rev/077caacae057
Comment 7•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
Assignee | ||
Comment 8•12 years ago
|
||
(In reply to Vladan Djeric (:vladan) from comment #6)
> Rafael is on vacation, so I landed this patch:
>
> https://hg.mozilla.org/integration/mozilla-inbound/rev/077caacae057
Thanks!
You need to log in
before you can comment on or make changes to this bug.
Description
•