Bug 104465 - [Chromium] Support for Network Information API
Summary: [Chromium] Support for Network Information API
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Gyuyoung Kim
URL:
Keywords:
Depends on: 104642
Blocks:
  Show dependency treegraph
 
Reported: 2012-12-08 20:33 PST by Gyuyoung Kim
Modified: 2013-01-02 10:58 PST (History)
8 users (show)

See Also:


Attachments
Work-in-progress (16.85 KB, patch)
2012-12-08 20:43 PST, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch (18.87 KB, patch)
2012-12-09 23:16 PST, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch (20.07 KB, patch)
2012-12-10 02:19 PST, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch - Support network info change (19.27 KB, patch)
2012-12-11 19:57 PST, Gyuyoung Kim
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gyuyoung Kim 2012-12-08 20:33:11 PST
I think chrome port needs to support this spec as well as EFL and blackberry ports. Patch is coming.
Comment 1 Gyuyoung Kim 2012-12-08 20:43:35 PST
Created attachment 178393 [details]
Work-in-progress
Comment 2 Gyuyoung Kim 2012-12-09 23:16:33 PST
Created attachment 178480 [details]
Patch
Comment 3 WebKit Review Bot 2012-12-09 23:19:48 PST
Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, fishd@chromium.org, jamesr@chromium.org or tkent@chromium.org before submitting, as this patch contains changes to the Chromium public API. See also https://trac.webkit.org/wiki/ChromiumWebKitAPI.
Comment 4 WebKit Review Bot 2012-12-10 01:14:26 PST
Comment on attachment 178480 [details]
Patch

Attachment 178480 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/15252001

New failing tests:
fast/dom/navigator-detached-no-crash.html
Comment 5 Gyuyoung Kim 2012-12-10 02:19:25 PST
Created attachment 178495 [details]
Patch
Comment 6 Peter Beverloo 2012-12-10 09:49:20 PST
Hi Gyuyoung Kim, thank you for the patch.

We've just started reviewing the Network Information API, and (at least on the Android side) have doubts about both the quality of the API and the feasibility of implementing it correctly.

To give an example, it's going to be very hard to support the "bandwidth" attribute in a correct way on mobile devices. Conditions can change very significantly within minutes. While the "change" event can be triggered when the connection type changes (i.e. from 3G to WiFi), that doesn't give us any new estimates. 
Firefox has a mapping between the connection type and the theoretically possible connection speed, but being connected to LTE doesn't guarantee that the website is actually going to get 50 Mbps.

We'll be sending an e-mail regarding the concerns as soon as possible. For now, however, I'd prefer not to land this..
Comment 7 Darin Fisher (:fishd, Google) 2012-12-10 11:23:06 PST
Comment on attachment 178495 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=178495&action=review

R- based on Peter Beverloo's comments.

> Source/WebKit/chromium/public/WebViewClient.h:372
> +    virtual WebNetworkInfoClient* networkInfoClient() { return 0; }

WebKit API review notes: Network information is not a per-WebView property, so it
does not belong on WebViewClient.  There should instead be a Platform-level API
to query network information and to receive an event when network information
changes.
Comment 8 Gyuyoung Kim 2012-12-10 17:48:23 PST
(In reply to comment #6)
> Hi Gyuyoung Kim, thank you for the patch.
> 
> We've just started reviewing the Network Information API, and (at least on the Android side) have doubts about both the quality of the API and the feasibility of implementing it correctly.
> 
> To give an example, it's going to be very hard to support the "bandwidth" attribute in a correct way on mobile devices. Conditions can change very significantly within minutes. While the "change" event can be triggered when the connection type changes (i.e. from 3G to WiFi), that doesn't give us any new estimates.

> Firefox has a mapping between the connection type and the theoretically possible connection speed, but being connected to LTE doesn't guarantee that the website is actually going to get 50 Mbps.
> 
> We'll be sending an e-mail regarding the concerns as soon as possible. For now, however, I'd prefer not to land this..

Hi Peter, yes, Firefox and WebKit blackberry supported bandwidth property based on theoretical bandwidth speed. So, I also implemented this feature for Tizen platform as same method.

In blackberry port case, they notify network type change to JS callback by this implementation. I'm considering to let WebCore know network type change via virtual interface.

void NetworkInfoClientBlackBerry::onCurrentNetworkTypeChange(BlackBerry::Platform::InternalNetworkConnectionType newInternalNetworkType)
{
    if (m_isActive) {
        RefPtr<NetworkInfo> newNetworkInfo = NetworkInfo::create(bandwidth(), metered());
        NetworkInfoController::from(m_webPagePrivate->m_page)->didChangeNetworkInformation(eventNames().webkitnetworkinfochangeEvent , newNetworkInfo.get());
    }
}

Anyway, if you have doubts in this implementations, I'm willing to wait for your consideration.
Comment 9 Gyuyoung Kim 2012-12-10 20:45:53 PST
(In reply to comment #7)
> (From update of attachment 178495 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=178495&action=review
> 
> R- based on Peter Beverloo's comments.
> 
> > Source/WebKit/chromium/public/WebViewClient.h:372
> > +    virtual WebNetworkInfoClient* networkInfoClient() { return 0; }
> 
> WebKit API review notes: Network information is not a per-WebView property, so it
> does not belong on WebViewClient.  There should instead be a Platform-level API
> to query network information and to receive an event when network information
> changes.

In EFL port, we placed concrete implementation to WebCore/platform/efl in order to share it with both WK1 and WK2. But, we keep an interface for metered() functionality because we wasn't convinced if all platforms can support metered(). In Mozilla and blackberry cases, they support metered() by checking if current network is cellular. I also supported metered() functionality for Tizen as mozilla and blackberry. Do you think all chromium ports(win, linux, android and so on) can support metered() in platform-level API ?
Comment 10 Darin Fisher (:fishd, Google) 2012-12-10 22:06:18 PST
(In reply to comment #9)
...
> In EFL port, we placed concrete implementation to WebCore/platform/efl in order to share it with both WK1 and WK2. But, we keep an interface for metered() functionality because we wasn't convinced if all platforms can support metered(). In Mozilla and blackberry cases, they support metered() by checking if current network is cellular. I also supported metered() functionality for Tizen as mozilla and blackberry. Do you think all chromium ports(win, linux, android and so on) can support metered() in platform-level API ?

I'm sorry, I don't know what metered() means.  My comment is that network information does not seem to be WebView-dependent.  It seems to be a property that is global to the system, and it does not depend on any DOM constructs.  In the Chromium world, that implies that the method should live on the WebKit::Platform interface.  NOTE: That interface is implemented by Chromium via dependency injection.
Comment 11 Gyuyoung Kim 2012-12-11 19:57:24 PST
Created attachment 178951 [details]
Patch - Support network info change
Comment 12 Gyuyoung Kim 2012-12-11 20:05:26 PST
I add function to update network type change as battery status implementation. But, I still need to consider how to move this implementation to Platform layer. 

By the way, I doubt how was battery status implementation landed before. Because, IMHO, the battery status doesn't need to have webview dependency as well. I will check it.
Comment 13 Gyuyoung Kim 2012-12-27 21:37:01 PST
Adam, do you think network information API should be moved to Platform layer ? I made this patch based on BatteryStatus API for chromium port (Bug 83284). Because, I'm not sure that *metered* functionality can be supported by WebKit::Platform interface. If there is difference between battery status and network info, please let me know.
Comment 14 James Robinson 2013-01-02 10:58:29 PST
Given comment #6 I don't think it's worth using reviewer time on this patch at this time.