Closed Bug 764614 Opened 12 years ago Closed 12 years ago

add b2g shell.js code to take and save system screenshots

Categories

(Firefox OS Graveyard :: General, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
DeveloperPhone

People

(Reporter: djf, Assigned: djf)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch patch (obsolete) — Splinter Review
The attached patch adds code to b2g/chrome/content/shell.js to enable screenshots.

Requires https://bugzilla.mozilla.org/show_bug.cgi?id=764604 to land before it will work right
Attachment #632907 - Flags: review?(21)
Comment on attachment 632907 [details] [diff] [review]
patch

Review of attachment 632907 [details] [diff] [review]:
-----------------------------------------------------------------

Only styling nits.

::: b2g/chrome/content/shell.js
@@ +585,5 @@
> +// detail.type set to 'save-screenshot'.  Then we take a screenshot
> +// save it in device storage (external) and send a mozChromeEvent with
> +// detail.type set to 'saved-screenshot' and detail.filename set to
> +// the filename.
> +window.addEventListener('ContentStart', function() {

nit: add a name to your anonymous function

@@ +586,5 @@
> +// save it in device storage (external) and send a mozChromeEvent with
> +// detail.type set to 'saved-screenshot' and detail.filename set to
> +// the filename.
> +window.addEventListener('ContentStart', function() {
> +  content.addEventListener('mozContentEvent', function(e) {

nit: add a name to your anonymous function

@@ +604,5 @@
> +        context.DRAWWINDOW_DRAW_CARET |
> +        context.DRAWWINDOW_DRAW_VIEW |
> +        context.DRAWWINDOW_USE_WIDGET_LAYERS;
> +      context.drawWindow(window, 0, 0, width, height,
> +                         'rgb(255,255,255)', flags);

I will normally suggest to try using getScreenshot but you can't pass flags there.

@@ +627,5 @@
> +            type: 'save-screenshot-success',
> +            filename: filename
> +          });
> +        }
> +        catch(e) {

nit: } catch (e) {

@@ +631,5 @@
> +        catch(e) {
> +          dump('exception in onsuccess ' + e + '\n');
> +        }
> +      };
> +      saveRequest.onerror = function() {

nit: add a name to your anonymous function

@@ +638,5 @@
> +            type: 'save-screenshot-error',
> +            error: saveRequest.error.name
> +          });
> +        }
> +        catch(e) {

nit: } catch(e) {

@@ +643,5 @@
> +          dump('exception in onerror ' + e + '\n');
> +        }
> +      };
> +    }
> +    catch(e) {

nit: } catch(e) {
Attachment #632907 - Flags: review?(21) → review+
This patch fixes the stylistic bugs that vingtetun identified in his r+ review.
Attachment #632907 - Attachment is obsolete: true
Keywords: checkin-needed
https://hg.mozilla.org/integration/mozilla-inbound/rev/348cc668ea23
Assignee: nobody → dflanagan
Status: NEW → ASSIGNED
Keywords: checkin-needed
Target Milestone: --- → DeveloperPhone
https://hg.mozilla.org/mozilla-central/rev/348cc668ea23
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: