Closed Bug 1376445 Opened 4 years ago Closed 2 years ago

"Copy All As HAR" is not working on Net Monitor Launchpad

Categories

(DevTools :: Netmonitor, defect, P3)

56 Branch
defect

Tracking

(firefox56 affected, firefox57 fix-optional)

RESOLVED INVALID
Tracking Status
firefox56 --- affected
firefox57 --- fix-optional

People

(Reporter: ciprian_georgiu, Unassigned)

References

Details

[Affected versions]:
- latest Nightly 56.0a1

[Affected platforms]:
- Windows 10 x64
- Mac OS X 10.11.6
- Ubuntu 16.04 x64 LTS

[Steps to reproduce]:
1. Start Firefox.
2. Launch any website, e.g.: wiki.mozilla.org/ in Netmonitor Launchpad.
3. Choose a request and open context menu via right click.
4. From context menu select Copy -> Copy All As HAR

[Expected result]:
- HAR logs are properly copied to clipboard.

[Actual result]:
- No text is copied to clipboard.

[Regression range]:
- This issue can also be repro with "devtools-launchpad": "=0.0.67", so I don't think it's a regression.

[Additional notes]:
- This was reproduced with "devtools-launchpad": "=0.0.75" version
- Note that this issue is not repro with Netmonitor opened from Devtools
- I see the following warnings in browser console for the Copy All As Har action: document.execCommand(‘cut’/‘copy’) was denied because it was not called from inside a short running user-generated event handler.
...
> - I see the following warnings in browser console for the Copy All As Har
> action: document.execCommand(‘cut’/‘copy’) was denied because it was not
> called from inside a short running user-generated event handler.

Hi Ricky,

I've noticed that, If I click on the netmonitor.js:80024:3 warning, bug 1295692 appear commented in function: function getCurrentFlavors() {
	  // See bug 1295692.
	  return [];
	}
	
	function getData() {
	  // See bug 1295692.
	  return null;
	}

I am wondering if the above bug can be the reason of why this is not working in Netmonitor Launchpad, could you please confirm or not this?
Thanks!
Flags: needinfo?(rchien)
Ciprian Georgiu, thanks for spotting this issue!

In short, I suspect that bug 1295692 is irrelevant to this.

Indeed, "Copy All As HAR" is a known issue when running on Launchpad. According to documentation, the "cut" and "copy" commands should work without any special permission if you are using them in a short-lived event handler for a user action (for example, a click handler). However, we're using it within [1] an async non-short-lived callback.

We have to figure out a better solution to support copy / cut when running in Launchpad. Probably prepare data from `fetchHarData` at the beginning and then we can invoke this copy() function [2] within a short-lived event handler.

[1] http://searchfox.org/mozilla-central/source/devtools/client/netmonitor/src/har/har-exporter.js#116-119
[2] http://searchfox.org/mozilla-central/source/devtools/client/netmonitor/src/har/har-exporter.js#115
Flags: needinfo?(rchien)
Product: Firefox → DevTools

The launchpad is no longer supported for the Network monitor, closing.
Honza

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.