Closed Bug 1448288 Opened 7 years ago Closed 7 years ago

Make devtools.network.getHAR API compatible with Chrome

Categories

(DevTools :: Netmonitor, defect, P1)

defect

Tracking

(firefox60 fixed, firefox61 fixed)

RESOLVED FIXED
Firefox 61
Tracking Status
firefox60 --- fixed
firefox61 --- fixed

People

(Reporter: Honza, Assigned: Honza)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

This is a follow up for bug 1311177 See also this comment: https://bugzilla.mozilla.org/show_bug.cgi?id=1311177#c38 In Chrome, the object returned from getHAR is a HAR "log" (http://www.softwareishard.com/blog/har-12-spec/#log), so you could do something like: function gotHar(har) { document.querySelector("#har").textContent = `Har: ${har.version}`; console.log(har); } document.querySelector("#gethar").addEventListener("click", () => { chrome.devtools.network.getHAR(gotHar); }); Firefox should behave the same. Honza
Assignee: nobody → odvarko
Status: NEW → ASSIGNED
Priority: -- → P1
Comment on attachment 8961725 [details] Bug 1448288 - Make devtools.network.getHAR API compatible with Chrome; https://reviewboard.mozilla.org/r/230600/#review236078 Thanks Jan for quickly fixing this incompatibility with the format of the result of the related Chrome API. Do you mind if we also add a couple of additional steps in this test to verify that the empty log is still correctly received when the netmonitor panel has been selected but no network data has been collected yet? (which should be enough to verify that Bug 1447840 is also fixed by this patch). we could just add the following steps near line 172: ``` // Select the Net panel. await toolbox.selectTool("netmonitor"); // Get HAR again, it should be empty because the Panel is selected but no data collected yet. const getHAREmptyPromiseWithPanel = extension.awaitMessage("getHAR-result"); extension.sendMessage("getHAR"); const emptyResultWithPanel = await getHAREmptyPromiseWithPanel; is(emptyResultWithPanel.entries.length, 0, "HAR log should be empty"); // Reload the page to collect some HTTP requests. ... ```
Attachment #8961725 - Flags: review?(lgreco) → review+
(In reply to Luca Greco [:rpl] from comment #3) > Do you mind if we also add a couple of additional steps in this test to > verify that the empty log is still > correctly received when the netmonitor panel has been selected but no > network data has been collected yet? > (which should be enough to verify that Bug 1447840 is also fixed by this > patch). Done The HAR log is always generated even if there are no requests. Thanks for the review Luca! Honza
Pushed by jodvarko@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7e8b408417b8 Make devtools.network.getHAR API compatible with Chrome; r=rpl
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 61
Comment on attachment 8961725 [details] Bug 1448288 - Make devtools.network.getHAR API compatible with Chrome; Approval Request Comment [Feature/Bug causing the regression]: bug 1311171 [User impact if declined]: Non compatible WebExtension API (for DevTools Network panel) [Is this code covered by automated tests?]: Yes [Has the fix been verified in Nightly?]: Yes [Needs manual test from QE? If yes, steps to reproduce]: No [List of other uplifts needed for the feature/fix]: n/a [Is the change risky?]: Low risk [Why is the change risky/not risky?]: Small patch, just for extension developer audience. [String changes made/needed]: n/a
Attachment #8961725 - Flags: approval-mozilla-beta?
Comment on attachment 8961725 [details] Bug 1448288 - Make devtools.network.getHAR API compatible with Chrome; fix for a new API in 60, beta60+
Attachment #8961725 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: