Closed Bug 1134106 Opened 9 years ago Closed 9 years ago

Graphene chrome tweaks

Categories

(Firefox OS Graveyard :: Runtime, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: paul, Assigned: paul)

References

Details

(Whiteboard: graphene-larch)

Attachments

(17 files, 8 obsolete files)

3.82 KB, patch
fabrice
: review+
Details | Diff | Splinter Review
2.46 KB, patch
fabrice
: review+
Details | Diff | Splinter Review
1022 bytes, patch
fabrice
: review+
Details | Diff | Splinter Review
1.46 KB, patch
fabrice
: review+
Details | Diff | Splinter Review
1.89 KB, patch
fabrice
: review-
Details | Diff | Splinter Review
3.13 KB, patch
fabrice
: review+
Details | Diff | Splinter Review
2.27 KB, patch
fabrice
: review+
Details | Diff | Splinter Review
849 bytes, patch
fabrice
: review+
Details | Diff | Splinter Review
1.23 KB, patch
fabrice
: review+
Details | Diff | Splinter Review
695 bytes, patch
fabrice
: review+
Details | Diff | Splinter Review
888 bytes, patch
fabrice
: review+
Details | Diff | Splinter Review
938 bytes, patch
fabrice
: review+
Details | Diff | Splinter Review
1.42 KB, patch
fabrice
: review+
Details | Diff | Splinter Review
379 bytes, patch
fabrice
: review+
Details | Diff | Splinter Review
1.27 KB, patch
fabrice
: review+
Details | Diff | Splinter Review
1.61 KB, patch
fabrice
: review+
Details | Diff | Splinter Review
982 bytes, patch
fabrice
: review+
Details | Diff | Splinter Review
Attached patch Part 1Splinter Review
- hide scrollbars for the scrollgrab container
- enable window dragging
- bunch of prefs
Attachment #8565824 - Flags: review?(fabrice)
Blocks: graphene
Attachment #8565824 - Flags: review?(fabrice) → review+
Depends on: 1121217
Attached patch Part 2 (obsolete) — Splinter Review
Attachment #8570351 - Flags: review?(fabrice)
Attached patch Part 2Splinter Review
Attachment #8570351 - Attachment is obsolete: true
Attachment #8570351 - Flags: review?(fabrice)
Attachment #8570407 - Flags: review?(fabrice)
Attachment #8570407 - Flags: review?(fabrice) → review+
Attached patch Part 3Splinter Review
Attachment #8572523 - Flags: review?(fabrice)
Attachment #8565824 - Attachment description: v1 → Part 1
Comment on attachment 8572523 [details] [diff] [review]
Part 3

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

:(
Attachment #8572523 - Flags: review?(fabrice) → review+
Attached patch Part 4Splinter Review
To avoid flickering at startup, we want the cocoa window to be white, not black.
Attachment #8575791 - Flags: review?(fabrice)
Attachment #8575791 - Flags: review?(fabrice) → review+
Attached patch Part 5Splinter Review
Fabrice, I'm not sure if this is the right way to do it. Let me know what you think.

We can't use fullscreen from content, because after a reload, it would unfullscreen the content (which is not surprising).

Also, I had to remove teh removeEventListener as we want to get events even after a reload.
Attachment #8576420 - Flags: review?(fabrice)
Attached patch Part 6Splinter Review
The persist mechanism only works with xul documents:
http://mxr.mozilla.org/mozilla-central/source/xpfe/appshell/nsXULWindow.cpp#1486

I use prefs because we to call resizeTo and moveTo synchronously.
Assignee: nobody → paul
Status: NEW → ASSIGNED
Attachment #8577873 - Flags: review?(fabrice)
Attached patch Part 7 (obsolete) — Splinter Review
This allows the content to reload more aggressively.
Attachment #8577892 - Flags: review?(fabrice)
Attached patch Part 7Splinter Review
Attachment #8577892 - Attachment is obsolete: true
Attachment #8577892 - Flags: review?(fabrice)
Attachment #8577893 - Flags: review?(fabrice)
Comment on attachment 8576420 [details] [diff] [review]
Part 5

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

I don't understand the event listener changes. Please provide str.

::: b2g/chrome/content/shell.js
@@ -633,5 @@
>    },
>  
>    notifyContentStart: function shell_notifyContentStart() {
> -    this.contentBrowser.removeEventListener('mozbrowserloadstart', this, true);
> -    this.contentBrowser.removeEventListener('mozbrowserlocationchange', this, true);

I don't understand this change. We don't need to run SystemAppProxy registration again, etc. on reload. What is that fixing exactly?
Attachment #8576420 - Flags: review?(fabrice) → review-
Attachment #8577873 - Flags: review?(fabrice) → review+
Attachment #8577893 - Flags: review?(fabrice) → review+
(In reply to Fabrice Desré [:fabrice] from comment #14)
> Comment on attachment 8576420 [details] [diff] [review]
> Part 5
> 
> Review of attachment 8576420 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> I don't understand the event listener changes. Please provide str.

I'm not sure exactly what should be done on reload. But the listeners don't work anymore:

STR:
- start B2G
- press fullscreen button
- it goes fullscreen
- press fullscreen button
- back to non-fullscreen window
- F5
- press fullscreen button
- Nothing happens

Maybe we should only call `CustomEventManager.init()` on reload.
Flags: needinfo?(fabrice)
ok, I'm gonna take a look at what we need to do and will land that with the other 2 patches.
Flags: needinfo?(fabrice)
Attached patch Part 8 (obsolete) — Splinter Review
Delegating command line handling to the app. It will be used for things like `-url xxx` `-open xxx` …
Attachment #8600803 - Flags: review?(fabrice)
Comment on attachment 8600803 [details] [diff] [review]
Part 8

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

This patch is a very generic pass-through. I'm not opposed if we have use cases beyond opening a new page. If not, we should just use the support for window.open(..., "_blank").
Attachment #8600803 - Flags: review?(fabrice)
Attached patch Part 8 (obsolete) — Splinter Review
Is this approach better?
What do you mean by supporting `window.open(..., "_blank")`?
Attachment #8601257 - Flags: review?(fabrice)
What I meant is that in gaia, we have support for opening new "tabs" when a page does window.open("http://foo.com", "_blank") and that we could reuse that to trigger the tab load instead of sending the command line argument to the system app.
We also support a "view" activity, but I'm not sure if that makes sense to add that to browser.html
Still not sure to understand.

What we're trying to achieve here is to support the `-url` command line argument that is (indirectly) used by the OS.

This is how it works:
- set Graphene as your default browser
- go to your email client, click on a link
- OS X will send a cocoa URLEvent to gecko
- gecko will translate this event into a command line argument (-url url)
- gecko run all the command line handlers

So we need a command line handler to forward this URL to, first, shell.js, then, the app.

Are you saying that instead of sending an event to the app, we should use call `window.open` from within the app? Something like: in shell.js: content.open(url, "_blank"), and the app would then open a tab?

I can think of 3 ways to build that:
- listen to mozbrowseropenwindow from shell.js, but then, you still need to send a message back to the app iframe
- implement nsIWindowProvider
- override the native `open` call

But I couldn't find any of these things in /b2g/. And I actually tried to call window.open(url, _blank) in Gaia's system app. Nothing happens.

What am I missing?
Flags: needinfo?(fabrice)
browser.html (and gaia) use the mozbrowseropenwindow event for that, so why not have shell.js dispatch such an event on the systemApp iframe?
Flags: needinfo?(fabrice)
(In reply to Fabrice Desré [:fabrice] from comment #23)
> browser.html (and gaia) use the mozbrowseropenwindow event for that, so why
> not have shell.js dispatch such an event on the systemApp iframe?

Are you suggesting that I just rename "opentab" to "mozbrowseropenwindow" in attachment 8601257 [details] [diff] [review]?
Flags: needinfo?(fabrice)
(In reply to Paul Rouget [:paul] from comment #24)
> (In reply to Fabrice Desré [:fabrice] from comment #23)
> > browser.html (and gaia) use the mozbrowseropenwindow event for that, so why
> > not have shell.js dispatch such an event on the systemApp iframe?
> 
> Are you suggesting that I just rename "opentab" to "mozbrowseropenwindow" in
> attachment 8601257 [details] [diff] [review]?

Yes, if that works that's all we need!
Flags: needinfo?(fabrice)
Attached patch Part 9 (obsolete) — Splinter Review
Attachment #8604451 - Flags: review?(fabrice)
Attached patch Part 8 (obsolete) — Splinter Review
Attachment #8600803 - Attachment is obsolete: true
Attachment #8601257 - Attachment is obsolete: true
Attachment #8601257 - Flags: review?(fabrice)
Attachment #8604455 - Flags: review?(fabrice)
Attachment #8604455 - Attachment description: Parth 8 → Part 8
Comment on attachment 8604455 [details] [diff] [review]
Part 8

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

looks fine, except the `url` in the js object. If that works, I don't understand why.

::: b2g/chrome/content/shell.js
@@ +708,5 @@
> +    try {
> +      // Returns null if -url is not present
> +      let url = args.handleFlagWithParam("url", false);
> +      if (url) {
> +        this.sendChromeEvent({type: "mozbrowseropenwindow", url});

url: url ??

::: b2g/components/CommandLine.js
@@ +14,5 @@
>  
>  CommandlineHandler.prototype = {
>      handle: function(cmdLine) {
>        this.cmdLine = cmdLine;
> +      let win = Services.wm.getMostRecentWindow('navigator:browser');

nit: double quotes in this file.
Attachment #8604455 - Flags: review?(fabrice)
Attachment #8604451 - Flags: review?(fabrice) → review+
(In reply to Fabrice Desré [:fabrice] from comment #28)
> Comment on attachment 8604455 [details] [diff] [review]
> Part 8
> 
> Review of attachment 8604455 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> looks fine, except the `url` in the js object. If that works, I don't
> understand why.
> 
> ::: b2g/chrome/content/shell.js
> @@ +708,5 @@
> > +    try {
> > +      // Returns null if -url is not present
> > +      let url = args.handleFlagWithParam("url", false);
> > +      if (url) {
> > +        this.sendChromeEvent({type: "mozbrowseropenwindow", url});
> 
> url: url ??

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#Property_definitions

> ::: b2g/components/CommandLine.js
> @@ +14,5 @@
> >  
> >  CommandlineHandler.prototype = {
> >      handle: function(cmdLine) {
> >        this.cmdLine = cmdLine;
> > +      let win = Services.wm.getMostRecentWindow('navigator:browser');
> 
> nit: double quotes in this file.

ok.
Attached patch Part 8 (obsolete) — Splinter Review
Attachment #8604455 - Attachment is obsolete: true
Attachment #8604468 - Flags: review?(fabrice)
Attachment #8604468 - Flags: review?(fabrice) → review+
Actually we could land part 8 & 9 on m-c. Do you mind moving them to their own bug carrying r+ ?
(In reply to Fabrice Desré [:fabrice] from comment #31)
> Actually we could land part 8 & 9 on m-c. Do you mind moving them to their
> own bug carrying r+ ?

ok!
Attachment #8604451 - Attachment is obsolete: true
Attachment #8604468 - Attachment is obsolete: true
See bug 1163905 and bug 1163904.
Attached patch Part 8Splinter Review
Fabrice, this is required to enable testing. See https://github.com/mozilla/browser.html/pull/392
Attachment #8623122 - Flags: review?(fabrice)
Attachment #8623122 - Flags: review?(fabrice) → review+
Attached patch Part 9Splinter Review
Earlier, we switched from the fullscreen wep api to window.fullScreen, but I forgot to fix the way we register the fullscreen state.
Attachment #8625045 - Flags: review?(fabrice)
Comment on attachment 8625045 [details] [diff] [review]
Part 9

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

I'll land once we merge m-c in.
Attachment #8625045 - Flags: review?(fabrice) → review+
Attached patch Part 10Splinter Review
Attachment #8627535 - Flags: review?(fabrice)
Attachment #8627535 - Flags: review?(fabrice) → review+
Attached patch Part 11Splinter Review
Attachment #8627670 - Flags: review?(fabrice)
Attachment #8627670 - Flags: review?(fabrice) → review+
Attachment #8627670 - Attachment description: Parth 11 → Part 11
Attached patch Part 12Splinter Review
We want to enable/disable APZC directly from browser.html. In the long term, I don't think we want to keep that, but for now, this will help us a lot.
Attachment #8632627 - Flags: review?(fabrice)
Went ahead and pushed Part 12: https://hg.mozilla.org/projects/larch/rev/45796a4b1a48
Attached patch Part 13Splinter Review
Attachment #8635098 - Flags: review?(fabrice)
Whiteboard: graphene-larch → graphene-larch landed-in-larch-without-review
Attached patch Part 14Splinter Review
Let's disable the devtools now we have the UI to enable them in browser.html (F12).
Attachment #8639144 - Flags: review?(fabrice)
Attached patch Part 15Splinter Review
Attachment #8639198 - Flags: review?(fabrice)
Attachment #8632627 - Flags: review?(fabrice) → review+
Attachment #8635098 - Flags: review?(fabrice) → review+
Attachment #8639144 - Flags: review?(fabrice) → review+
Attachment #8639198 - Flags: review?(fabrice) → review+
remote:   https://hg.mozilla.org/projects/larch/rev/010bc244a855
remote:   https://hg.mozilla.org/projects/larch/rev/feee383db2f0
Whiteboard: graphene-larch landed-in-larch-without-review → graphene-larch
Attached patch Part 16 (obsolete) — Splinter Review
More prefs.
Attachment #8642812 - Flags: review?(fabrice)
Attached patch Part 17Splinter Review
Touch caret is back.
Attachment #8644175 - Flags: review?(fabrice)
Comment on attachment 8642812 [details] [diff] [review]
Part 16

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

::: b2g/graphene/graphene.js
@@ +47,5 @@
>  pref("b2g.nativeWindowGeometry.fullscreen", false);
>  
>  pref("media.useAudioChannelService", false);
>  
> +pref("browser.sessionhistory.max_total_viewers", -1);

I'd like this to be changed in the main b2g.js. We don't target low end by default now.

@@ +48,5 @@
>  
>  pref("media.useAudioChannelService", false);
>  
> +pref("browser.sessionhistory.max_total_viewers", -1);
> +pref("network.predictor.enabled", true);

Let's keep this one in graphene only, as I'm not sure about the consequences in terms of data consumption.
Attachment #8642812 - Flags: review?(fabrice) → feedback+
Attachment #8644175 - Flags: review?(fabrice) → review+
Attached patch Part 16Splinter Review
See bug 1192133 for the total_viewers pref.
Attachment #8642812 - Attachment is obsolete: true
Attachment #8644795 - Flags: review?(fabrice)
Attachment #8644795 - Flags: review?(fabrice) → review+
I believe everything here was rolled-up and landed in mozilla-central via bug 1204965.
Status: ASSIGNED → RESOLVED
Closed: 9 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: