Closed
Bug 1237087
Opened 8 years ago
Closed 8 years ago
Add ability for WebCompatReporter ("Report Site Issue") to send screenshots to new issue form
Categories
(Firefox for Android Graveyard :: General, defect)
Firefox for Android Graveyard
General
Tracking
(firefox48 fixed)
RESOLVED
FIXED
Firefox 48
Tracking | Status | |
---|---|---|
firefox48 | --- | fixed |
People
(Reporter: miketaylr, Assigned: miketaylr)
Details
Attachments
(2 files, 7 obsolete files)
4.53 KB,
patch
|
miketaylr
:
review+
|
Details | Diff | Splinter Review |
4.31 KB,
patch
|
miketaylr
:
review+
|
Details | Diff | Splinter Review |
We've updated webcompat.com to have better image uploading capabilities and would like reports that come from the Nightly "Report Site Issue" to attach a screenshot by default - "anonymous" reports often contain very little context. Users will have the opportunity to remove it before submitting. See https://github.com/webcompat/webcompat.com/issues/879#issuecomment-169107610 for a gif of the same functionality in our Chrome add-on.
Assignee | ||
Comment 1•8 years ago
|
||
Assignee | ||
Comment 2•8 years ago
|
||
Assignee | ||
Comment 3•8 years ago
|
||
Assignee | ||
Updated•8 years ago
|
Attachment #8727465 -
Attachment is obsolete: true
Assignee | ||
Comment 4•8 years ago
|
||
Assignee | ||
Updated•8 years ago
|
Attachment #8727466 -
Attachment is obsolete: true
Assignee | ||
Comment 5•8 years ago
|
||
Comment on attachment 8727472 [details] [diff] [review] Part 1 - Refactor WebCompatReport.reportIssue to take an object argument. r=? Sebastian, would you mind reviewing?
Attachment #8727472 -
Flags: review?(s.kaspari)
Assignee | ||
Updated•8 years ago
|
Attachment #8727473 -
Flags: review?(s.kaspari)
Assignee | ||
Comment 6•8 years ago
|
||
In case it's helpful as context, here's where we handle incoming message events for the bug form (including making sure we only accept our own origin): https://github.com/webcompat/webcompat.com/blob/master/webcompat/static/js/lib/bugform.js#L52-L63
Comment 7•8 years ago
|
||
Comment on attachment 8727472 [details] [diff] [review] Part 1 - Refactor WebCompatReport.reportIssue to take an object argument. r=? Review of attachment 8727472 [details] [diff] [review]: ----------------------------------------------------------------- ::: mobile/android/chrome/content/WebcompatReporter.js @@ +58,5 @@ > addMenuItem: function(visible) { > this.menuItem = NativeWindow.menu.add({ > name: this.strings.GetStringFromName("webcompat.menu.name"), > callback: () => { > + this.reportIssue({url: BrowserApp.selectedTab.browser.currentURI.spec;}}); This line seems to be malformed (semicolon and double closing "}"). But it looks like the next commit fixes this. Maybe collapse them?
Attachment #8727472 -
Flags: review?(s.kaspari) → review+
Comment 8•8 years ago
|
||
Comment on attachment 8727473 [details] [diff] [review] Part 2 - Send screenshot of visible window when reporting site issue. r=? Review of attachment 8727473 [details] [diff] [review]: ----------------------------------------------------------------- LGTM but I would like Margaret to take a quick look too.
Attachment #8727473 -
Flags: review?(s.kaspari)
Attachment #8727473 -
Flags: review?(margaret.leibovic)
Attachment #8727473 -
Flags: review+
Assignee | ||
Comment 9•8 years ago
|
||
Thanks for review! (In reply to Sebastian Kaspari (:sebastian) from comment #7) > This line seems to be malformed (semicolon and double closing "}"). But it > looks like the next commit fixes this. Maybe collapse them? Ah, dang. I tried to fix that up in a rebase and naturally screwed it up. Will fix (and check it multiple times). I'm not sure there's a ton of value in keeping this tiny refactor in a different commit, so maybe I will just combine both patches.
Assignee | ||
Comment 10•8 years ago
|
||
Attachment #8727516 -
Flags: review+
Assignee | ||
Updated•8 years ago
|
Attachment #8727472 -
Attachment is obsolete: true
Attachment #8727473 -
Attachment is obsolete: true
Attachment #8727473 -
Flags: review?(margaret.leibovic)
Assignee | ||
Comment 11•8 years ago
|
||
Comment on attachment 8727516 [details] [diff] [review] Send screenshot of visible window when reporting site issues. Combined commits (which fixes the semi-colon brace carnage).
Attachment #8727516 -
Flags: review+ → review?(margaret.leibovic)
Comment 12•8 years ago
|
||
Comment on attachment 8727473 [details] [diff] [review] Part 2 - Send screenshot of visible window when reporting site issue. r=? Review of attachment 8727473 [details] [diff] [review]: ----------------------------------------------------------------- ::: mobile/android/chrome/content/WebcompatReporter.js @@ +68,5 @@ > }); > }, > > + getScreenshot: (tab) => { > + return new Promise((resolve, reject) => { nit: reject is not used. @@ +84,5 @@ > + canvas.width = dpr * w; > + canvas.height = dpr * h; > + ctx.scale(dpr, dpr); > + ctx.drawWindow(win, x, y, w, h, '#ffffff'); > + let screenshot = canvas.toDataURL(); nit: Do you need this `let` here, or can you just put this into resolve below? @@ +89,5 @@ > + resolve({url: tab.browser.currentURI.spec, data: screenshot}); > + } catch (e) { > + // drawWindow can fail depending on memory or surface size. Rather than reject, we resolve > + // the URL so the user can continue to file an issue without a screenshot. > + Cu.reportError("Call to CanvasRenderingContext2d.drawWindow failed: " + e); nit: this means something in the above `try` failed, not just `drawWindow`. @@ +114,5 @@ > Snackbars.show(message, Snackbars.LENGTH_LONG, options); > }, > > + reportIssue: (tabData) => { > + return new Promise((resolve, reject) => { nit: reject is not used.
Attachment #8727473 -
Attachment is obsolete: false
Assignee | ||
Comment 13•8 years ago
|
||
Thanks Vlad, also just noticed the following:
> let isPrivateTab = PrivateBrowsingUtils.isBrowserPrivate(selectedTab.browser) ? true : false;
Seems like a useless ternary, isBrowserPrivate returns a boolean already.
Assignee | ||
Comment 14•8 years ago
|
||
Comment on attachment 8727516 [details] [diff] [review] Send screenshot of visible window when reporting site issues. Removing review request until I fix up Vlad's nits.
Attachment #8727516 -
Flags: review?(margaret.leibovic)
Assignee | ||
Updated•8 years ago
|
Attachment #8727473 -
Attachment is obsolete: true
Assignee | ||
Comment 15•8 years ago
|
||
Assignee | ||
Updated•8 years ago
|
Attachment #8727516 -
Attachment is obsolete: true
Assignee | ||
Updated•8 years ago
|
Attachment #8727541 -
Flags: review?(margaret.leibovic)
Comment 16•8 years ago
|
||
Comment on attachment 8727541 [details] [diff] [review] Send screenshot of visible window when reporting site issues. Review of attachment 8727541 [details] [diff] [review]: ----------------------------------------------------------------- Cool, this is neat. ::: mobile/android/chrome/content/WebcompatReporter.js @@ +116,5 @@ > > + reportIssue: (tabData) => { > + return new Promise((resolve) => { > + const WEBCOMPAT_ORIGIN = "https://webcompat.com"; > + let selectedTab = BrowserApp.selectedTab; It seems a bit odd that consumers are passing the selected tab's URL directly into this method, but then it still uses the selected tab itself for other things. Could you avoid passing along the URL altogether and just get it directly here? Or pass in the tab itself? But this is already an issue with this code, so not a big deal. @@ +126,5 @@ > + > + if (event.target.defaultView.location.origin === WEBCOMPAT_ORIGIN) { > + // Waive Xray vision so event.origin is not chrome://browser on the other side. > + let win = Cu.waiveXrays(event.target.defaultView); > + win.postMessage(tabData.data, WEBCOMPAT_ORIGIN); I'm not familiar with waiveXrays, but I'll trust it does what you intend it to do :)
Attachment #8727541 -
Flags: review?(margaret.leibovic) → review+
Assignee | ||
Comment 17•8 years ago
|
||
Thanks for review! (In reply to :Margaret Leibovic from comment #16) > Comment on attachment 8727541 [details] [diff] [review] > ::: mobile/android/chrome/content/WebcompatReporter.js > @@ +116,5 @@ > > > > + reportIssue: (tabData) => { > > + return new Promise((resolve) => { > > + const WEBCOMPAT_ORIGIN = "https://webcompat.com"; > > + let selectedTab = BrowserApp.selectedTab; > > It seems a bit odd that consumers are passing the selected tab's URL > directly into this method, but then it still uses the selected tab itself > for other things. Could you avoid passing along the URL altogether and just > get it directly here? Or pass in the tab itself? > > But this is already an issue with this code, so not a big deal. Good point! We should just grab the tab once and pass it around. (I'll change that in a new commit since it touches the reportDesktopModePrompt code too.) > @@ +126,5 @@ > > + > > + if (event.target.defaultView.location.origin === WEBCOMPAT_ORIGIN) { > > + // Waive Xray vision so event.origin is not chrome://browser on the other side. > > + let win = Cu.waiveXrays(event.target.defaultView); > > + win.postMessage(tabData.data, WEBCOMPAT_ORIGIN); > > I'm not familiar with waiveXrays, but I'll trust it does what you intend it > to do :) Famous last words...
Assignee | ||
Comment 18•8 years ago
|
||
Assignee | ||
Updated•8 years ago
|
Attachment #8727541 -
Attachment is obsolete: true
Assignee | ||
Comment 19•8 years ago
|
||
Comment on attachment 8727631 [details] [diff] [review] Send screenshot of visible window when reporting site issues. r=sebastian, margaret Updating commit message to reflect Margaret's review and carrying forward r+.
Attachment #8727631 -
Flags: review+
Assignee | ||
Comment 20•8 years ago
|
||
Assignee | ||
Comment 21•8 years ago
|
||
Comment on attachment 8727633 [details] [diff] [review] Consistently pass tab references when reporting site issues. r=? Margaret, mind reviewing here? Try run: https://treeherder.mozilla.org/#/jobs?repo=try&revision=9164326fdfdc
Attachment #8727633 -
Flags: review?(margaret.leibovic)
Comment 22•8 years ago
|
||
Comment on attachment 8727633 [details] [diff] [review] Consistently pass tab references when reporting site issues. r=? Review of attachment 8727633 [details] [diff] [review]: ----------------------------------------------------------------- Nice cleanup.
Attachment #8727633 -
Flags: review?(margaret.leibovic) → review+
Assignee | ||
Comment 23•8 years ago
|
||
Attachment #8727693 -
Flags: review+
Assignee | ||
Updated•8 years ago
|
Attachment #8727633 -
Attachment is obsolete: true
Assignee | ||
Comment 24•8 years ago
|
||
Thanks again Sebastian and Margaret for feedback and reviews. (Updating commit msg and carrying forward r+ on the last patch)
Comment 25•8 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/e4f29173049f https://hg.mozilla.org/integration/mozilla-inbound/rev/6ac236f12205
Comment 26•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/e4f29173049f https://hg.mozilla.org/mozilla-central/rev/6ac236f12205
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox48:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 48
Updated•3 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•