| Differences between
and this patch
- a/Source/WebCore/ChangeLog +98 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2012-03-28  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
2
3
        Support the Network Information API
4
        https://bugs.webkit.org/show_bug.cgi?id=73528
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Network Information APIs is to provide an interface for Web Applications to access
9
        the underlying network information of device. In Web Application case, they need to know
10
        what current network interface it uses. Because, it is important to know current network
11
        information(bandwidth, metered) in mobile domain. Thus, Web Application can let user know
12
        whether current network information via this new functionality. In addition, in streaming
13
        service case, Web Application can control content resolution according to kind of network.
14
15
        http://dvcs.w3.org/hg/dap/raw-file/tip/network-api/index.html
16
17
        Tests: networkinformation/add-listener-from-callback.html
18
               networkinformation/basic-all-types-of-events.html
19
               networkinformation/basic-operation.html
20
               networkinformation/event-after-navigation.html
21
               networkinformation/multiple-frames.html
22
               networkinformation/updates.html
23
               networkinformation/window-property.html
24
25
        * CMakeLists.txt:
26
        * Modules/networkinfo/NavigatorNetworkInfoConnection.cpp: Added.
27
        (WebCore):
28
        (WebCore::NavigatorNetworkInfoConnection::NavigatorNetworkInfoConnection):
29
        (WebCore::NavigatorNetworkInfoConnection::~NavigatorNetworkInfoConnection):
30
        (WebCore::NavigatorNetworkInfoConnection::from):
31
        (WebCore::NavigatorNetworkInfoConnection::webkitConnection):
32
        * Modules/networkinfo/NavigatorNetworkInfoConnection.h: Added.
33
        (WebCore):
34
        (NavigatorNetworkInfoConnection):
35
        * Modules/networkinfo/NavigatorNetworkInfoConnection.idl: Added.
36
        * Modules/networkinfo/NetworkInfo.cpp: Added.
37
        (WebCore):
38
        (WebCore::NetworkInfo::NetworkInfo):
39
        * Modules/networkinfo/NetworkInfo.h: Added.
40
        (WebCore):
41
        (NetworkInfo):
42
        (WebCore::NetworkInfo::create):
43
        (WebCore::NetworkInfo::bandwidth):
44
        (WebCore::NetworkInfo::metered):
45
        * Modules/networkinfo/NetworkInfoClient.h: Added.
46
        (WebCore):
47
        (NetworkInfoClient):
48
        (WebCore::NetworkInfoClient::~NetworkInfoClient):
49
        * Modules/networkinfo/NetworkInfoConnection.cpp: Added.
50
        (WebCore):
51
        (WebCore::NetworkInfoConnection::create):
52
        (WebCore::NetworkInfoConnection::NetworkInfoConnection):
53
        (WebCore::NetworkInfoConnection::~NetworkInfoConnection):
54
        (WebCore::NetworkInfoConnection::bandwidth):
55
        (WebCore::NetworkInfoConnection::metered):
56
        (WebCore::NetworkInfoConnection::didChangeNetworkInformation):
57
        (WebCore::NetworkInfoConnection::addEventListener):
58
        (WebCore::NetworkInfoConnection::removeEventListener):
59
        (WebCore::NetworkInfoConnection::eventTargetData):
60
        (WebCore::NetworkInfoConnection::ensureEventTargetData):
61
        (WebCore::NetworkInfoConnection::interfaceName):
62
        (WebCore::NetworkInfoConnection::suspend):
63
        (WebCore::NetworkInfoConnection::resume):
64
        (WebCore::NetworkInfoConnection::stop):
65
        * Modules/networkinfo/NetworkInfoConnection.h: Added.
66
        (WebCore):
67
        (NetworkInfoConnection):
68
        (WebCore::NetworkInfoConnection::scriptExecutionContext):
69
        (WebCore::NetworkInfoConnection::canSuspend):
70
        (WebCore::NetworkInfoConnection::refEventTarget):
71
        (WebCore::NetworkInfoConnection::derefEventTarget):
72
        * Modules/networkinfo/NetworkInfoConnection.idl: Added.
73
        * Modules/networkinfo/NetworkInfoController.cpp: Added.
74
        (WebCore):
75
        (WebCore::NetworkInfoController::NetworkInfoController):
76
        (WebCore::NetworkInfoController::~NetworkInfoController):
77
        (WebCore::NetworkInfoController::create):
78
        (WebCore::NetworkInfoController::addListener):
79
        (WebCore::NetworkInfoController::removeListener):
80
        (WebCore::NetworkInfoController::didChangeNetworkInformation):
81
        (WebCore::NetworkInfoController::isActive):
82
        (WebCore::NetworkInfoController::supplementName):
83
        (WebCore::provideNetworkInfoTo):
84
        * Modules/networkinfo/NetworkInfoController.h: Added.
85
        (WebCore):
86
        (NetworkInfoController):
87
        (WebCore::NetworkInfoController::client):
88
        (WebCore::NetworkInfoController::from):
89
        * dom/EventNames.h:
90
        (WebCore):
91
        * dom/EventTargetFactory.in:
92
        * testing/Internals.cpp:
93
        (WebCore::Internals::setNetworkInformation):
94
        (WebCore):
95
        * testing/Internals.h:
96
        (Internals):
97
        * testing/Internals.idl:
98
1
2012-03-28  Li Yin  <li.yin@intel.com>
99
2012-03-28  Li Yin  <li.yin@intel.com>
2
100
3
        [WebSocket]Browser must fail connection if Sec-WebSocket-Protocol mismatched.
101
        [WebSocket]Browser must fail connection if Sec-WebSocket-Protocol mismatched.
- a/Source/WebKit/ChangeLog +9 lines
Lines 1-3 a/Source/WebKit/ChangeLog_sec1
1
2012-03-28  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
2
3
        Support the Network Information API
4
        https://bugs.webkit.org/show_bug.cgi?id=73528
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * PlatformEfl.cmake: Add dummy NetworkInfoClientEfl.cpp files in order to support network information API.
9
1
2012-03-22  Raphael Kubo da Costa  <rakuco@FreeBSD.org>
10
2012-03-22  Raphael Kubo da Costa  <rakuco@FreeBSD.org>
2
11
3
        [CMake] Unreviewed build fix after r111778.
12
        [CMake] Unreviewed build fix after r111778.
- a/Source/WebKit/efl/ChangeLog +24 lines
Lines 1-3 a/Source/WebKit/efl/ChangeLog_sec1
1
2012-03-28  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
2
3
        Support the Network Information API
4
        https://bugs.webkit.org/show_bug.cgi?id=73528
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Add NetworkInfoClientEfl to support network information API. However,
9
        functions are not implemented yet.
10
11
        * WebCoreSupport/NetworkInfoClientEfl.cpp: Added.
12
        (WebCore::NetworkInfoClientEfl::NetworkInfoClientEfl):
13
        (WebCore):
14
        (WebCore::NetworkInfoClientEfl::~NetworkInfoClientEfl):
15
        (WebCore::NetworkInfoClientEfl::startUpdating):
16
        (WebCore::NetworkInfoClientEfl::stopUpdating):
17
        (WebCore::NetworkInfoClientEfl::bandwidth):
18
        (WebCore::NetworkInfoClientEfl::metered):
19
        * WebCoreSupport/NetworkInfoClientEfl.h: Added.
20
        (NetworkInfoClientEfl):
21
        * ewk/ewk_view.cpp:
22
        (_Ewk_View_Private_Data):
23
        (_ewk_view_priv_new):
24
1
2012-03-28  Nate Chapin  <japhet@chromium.org>
25
2012-03-28  Nate Chapin  <japhet@chromium.org>
2
26
3
        Remove dispatchDidLoadMainResource callback, since no
27
        Remove dispatchDidLoadMainResource callback, since no
- a/Source/WebCore/CMakeLists.txt +18 lines
Lines 1627-1632 IF (ENABLE_NETSCAPE_PLUGIN_API) a/Source/WebCore/CMakeLists.txt_sec1
1627
    )
1627
    )
1628
ENDIF ()
1628
ENDIF ()
1629
1629
1630
IF (ENABLE_NETWORK_INFO)
1631
    LIST(APPEND WebCore_INCLUDE_DIRECTORIES
1632
         ${WEBCORE_DIR}/Modules/networkinfo
1633
    )
1634
1635
    LIST(APPEND WebCore_SOURCES
1636
        Modules/networkinfo/NavigatorNetworkInfoConnection.cpp
1637
        Modules/networkinfo/NetworkInfo.cpp
1638
        Modules/networkinfo/NetworkInfoConnection.cpp
1639
        Modules/networkinfo/NetworkInfoController.cpp
1640
    )
1641
 
1642
    LIST(APPEND WebCore_IDL_FILES
1643
        Modules/networkinfo/NavigatorNetworkInfoConnection.idl
1644
        Modules/networkinfo/NetworkInfoConnection.idl
1645
    )
1646
ENDIF ()
1647
1630
IF (ENABLE_NOTIFICATIONS)
1648
IF (ENABLE_NOTIFICATIONS)
1631
    LIST(APPEND WebCore_SOURCES
1649
    LIST(APPEND WebCore_SOURCES
1632
        notifications/DOMWindowNotifications.cpp
1650
        notifications/DOMWindowNotifications.cpp
- a/Source/WebCore/Modules/networkinfo/NavigatorNetworkInfoConnection.cpp +70 lines
Line 0 a/Source/WebCore/Modules/networkinfo/NavigatorNetworkInfoConnection.cpp_sec1
1
/*
2
 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions are met:
6
 *
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
14
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16
 * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
17
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
20
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
23
 * DAMAGE.
24
 */
25
26
#include "config.h"
27
#include "NavigatorNetworkInfoConnection.h"
28
29
#if ENABLE(NETWORK_INFO)
30
31
#include "Frame.h"
32
#include "Navigator.h"
33
#include "NetworkInfoController.h"
34
#include <wtf/PassOwnPtr.h>
35
36
namespace WebCore {
37
38
NavigatorNetworkInfoConnection::NavigatorNetworkInfoConnection()
39
{
40
}
41
42
NavigatorNetworkInfoConnection::~NavigatorNetworkInfoConnection()
43
{
44
}
45
46
NavigatorNetworkInfoConnection* NavigatorNetworkInfoConnection::from(Navigator* navigator)
47
{
48
    DEFINE_STATIC_LOCAL(AtomicString, name, ("NavigatorNetworkInfoConnection"));
49
    NavigatorNetworkInfoConnection* supplement = static_cast<NavigatorNetworkInfoConnection*>(Supplement<Navigator>::from(navigator, name));
50
    if (!supplement) {
51
        supplement = new NavigatorNetworkInfoConnection();
52
        provideTo(navigator, name, adoptPtr(supplement));
53
    }
54
    return supplement;
55
}
56
57
NetworkInfoConnection* NavigatorNetworkInfoConnection::webkitConnection(Navigator* navigator)
58
{
59
    if (!navigator->frame())
60
        return 0;
61
62
    NavigatorNetworkInfoConnection* navigatorConnection = NavigatorNetworkInfoConnection::from(navigator);
63
    if (!navigatorConnection->m_connection)
64
        navigatorConnection->m_connection = NetworkInfoConnection::create(navigator);
65
    return navigatorConnection->m_connection.get();
66
}
67
68
} // namespace WebCore
69
70
#endif // ENABLE(NETWORK_INFO)
- a/Source/WebCore/Modules/networkinfo/NavigatorNetworkInfoConnection.h +55 lines
Line 0 a/Source/WebCore/Modules/networkinfo/NavigatorNetworkInfoConnection.h_sec1
1
/*
2
 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions are met:
6
 *
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
14
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16
 * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
17
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
20
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
23
 * DAMAGE.
24
 */
25
26
#ifndef NavigatorNetworkInfoConnection_h
27
#define NavigatorNetworkInfoConnection_h
28
29
#if ENABLE(NETWORK_INFO)
30
31
#include "NetworkInfoConnection.h"
32
#include "Supplementable.h"
33
34
namespace WebCore {
35
36
class Navigator;
37
38
class NavigatorNetworkInfoConnection : public Supplement<Navigator> {
39
public:
40
    virtual ~NavigatorNetworkInfoConnection();
41
42
    static NavigatorNetworkInfoConnection* from(Navigator*);
43
    static NetworkInfoConnection* webkitConnection(Navigator*);
44
45
private:
46
    NavigatorNetworkInfoConnection();
47
48
    RefPtr<NetworkInfoConnection> m_connection;
49
};
50
51
} // namespace WebCore
52
53
#endif // ENABLE(NETWORK_INFO)
54
55
#endif // NavigatorNetworkInfoConnection_h
- a/Source/WebCore/Modules/networkinfo/NavigatorNetworkInfoConnection.idl +29 lines
Line 0 a/Source/WebCore/Modules/networkinfo/NavigatorNetworkInfoConnection.idl_sec1
1
/*
2
 * Copyright (C) 2012 Samsung Electronics. All Rights Reserved.
3
 *
4
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Library General Public
6
 * License as published by the Free Software Foundation; either
7
 * version 2 of the License, or (at your option) any later version.
8
 *
9
 * This library is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Library General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Library General Public License
15
 * along with this library; see the file COPYING.LIB.  If not, write to
16
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
 * Boston, MA 02110-1301, USA.
18
 */
19
20
module window {
21
22
    interface [
23
        Conditional=NETWORK_INFO,
24
        Supplemental=Navigator
25
    ] NavigatorNetworkInfoConnection {
26
        readonly attribute NetworkInfoConnection webkitConnection;
27
    };
28
29
}
- a/Source/WebCore/Modules/networkinfo/NetworkInfo.cpp +42 lines
Line 0 a/Source/WebCore/Modules/networkinfo/NetworkInfo.cpp_sec1
1
/*
2
 * Copyright (C) 2012 Samsung Electronics. All Rights Reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 *
8
 * 1.  Redistributions of source code must retain the above copyright
9
 *     notice, this list of conditions and the following disclaimer.
10
 * 2.  Redistributions in binary form must reproduce the above copyright
11
 *     notice, this list of conditions and the following disclaimer in the
12
 *     documentation and/or other materials provided with the distribution.
13
 * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
14
 *     its contributors may be used to endorse or promote products derived
15
 *     from this software without specific prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
28
29
#include "config.h"
30
#include "NetworkInfo.h"
31
32
#if ENABLE(NETWORK_INFO)
33
namespace WebCore {
34
35
NetworkInfo::NetworkInfo(long bandwidth, bool metered)
36
    : m_bandwidth(bandwidth)
37
    , m_metered(metered)
38
{
39
}
40
41
} // namespace WebCore
42
#endif
- a/Source/WebCore/Modules/networkinfo/NetworkInfo.h +56 lines
Line 0 a/Source/WebCore/Modules/networkinfo/NetworkInfo.h_sec1
1
/*
2
 * Copyright (C) 2012 Samsung Electronics. All Rights Reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 *
8
 * 1.  Redistributions of source code must retain the above copyright
9
 *     notice, this list of conditions and the following disclaimer.
10
 * 2.  Redistributions in binary form must reproduce the above copyright
11
 *     notice, this list of conditions and the following disclaimer in the
12
 *     documentation and/or other materials provided with the distribution.
13
 * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
14
 *     its contributors may be used to endorse or promote products derived
15
 *     from this software without specific prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
28
29
#ifndef NetworkInfo_h
30
#define NetworkInfo_h
31
32
#if ENABLE(NETWORK_INFO)
33
34
#include <wtf/PassRefPtr.h>
35
#include <wtf/RefCounted.h>
36
37
namespace WebCore {
38
39
class NetworkInfo : public RefCounted<NetworkInfo> {
40
public:
41
    static PassRefPtr<NetworkInfo> create(long bandwidth, bool metered) { return adoptRef(new NetworkInfo(bandwidth, metered)); }
42
43
    long bandwidth() const { return m_bandwidth; }
44
    bool metered() const { return m_metered; }
45
46
private:
47
    NetworkInfo(long bandwidth, bool metered);
48
49
    long m_bandwidth;
50
    bool m_metered;
51
};
52
53
} // namespace WebCore
54
55
#endif
56
#endif // NetworkInfoConnection_h
- a/Source/WebCore/Modules/networkinfo/NetworkInfoClient.h +56 lines
Line 0 a/Source/WebCore/Modules/networkinfo/NetworkInfoClient.h_sec1
1
/*
2
 * Copyright (C) 2012 Samsung Electronics. All Rights Reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
24
 */
25
26
#ifndef NetworkInfoClient_h
27
#define NetworkInfoClient_h
28
29
#if ENABLE(NETWORK_INFO)
30
31
#include <wtf/RefCounted.h>
32
#include <wtf/text/WTFString.h>
33
34
namespace WebCore {
35
36
class NetworkInfoController;
37
class Page;
38
39
class NetworkInfoClient : public RefCounted<NetworkInfoClient> {
40
public:
41
    virtual ~NetworkInfoClient() { }
42
43
    virtual unsigned int bandwidth() const = 0;
44
    virtual bool metered() const = 0;
45
   
46
    virtual void startUpdating() = 0;
47
    virtual void stopUpdating() = 0;
48
};
49
50
void provideNetworkInfoTo(Page*, NetworkInfoClient*);
51
52
}
53
54
#endif // ENABLE(NETWORK_INFO)
55
56
#endif // NetworkInfoClient_h
- a/Source/WebCore/Modules/networkinfo/NetworkInfoConnection.cpp +114 lines
Line 0 a/Source/WebCore/Modules/networkinfo/NetworkInfoConnection.cpp_sec1
1
/*
2
 * Copyright (C) 2012 Samsung Electronics. All Rights Reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 *
8
 * 1.  Redistributions of source code must retain the above copyright
9
 *     notice, this list of conditions and the following disclaimer.
10
 * 2.  Redistributions in binary form must reproduce the above copyright
11
 *     notice, this list of conditions and the following disclaimer in the
12
 *     documentation and/or other materials provided with the distribution.
13
 * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
14
 *     its contributors may be used to endorse or promote products derived
15
 *     from this software without specific prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
28
29
#include "config.h"
30
#include "NetworkInfoConnection.h"
31
32
#if ENABLE(NETWORK_INFO)
33
#include "Event.h"
34
#include "Frame.h"
35
#include "NetworkInfoClient.h"
36
37
namespace WebCore {
38
39
PassRefPtr<NetworkInfoConnection> NetworkInfoConnection::create(Navigator* navigator)
40
{
41
    RefPtr<NetworkInfoConnection> networkInfoConnection(adoptRef(new NetworkInfoConnection(navigator)));
42
    networkInfoConnection->suspendIfNeeded();
43
    return networkInfoConnection.release();
44
}
45
46
NetworkInfoConnection::NetworkInfoConnection(Navigator* navigator)
47
    : ActiveDOMObject(navigator->frame()->document(), this)
48
    , m_controller(NetworkInfoController::from(navigator->frame()->page()))
49
    , m_networkInfo(0)
50
{
51
    m_controller->addListener(this);
52
}
53
54
NetworkInfoConnection::~NetworkInfoConnection()
55
{
56
}
57
58
unsigned int NetworkInfoConnection::bandwidth() const
59
{
60
    if (m_networkInfo)
61
        return m_networkInfo->bandwidth();
62
    
63
    return m_controller->client()->bandwidth();
64
}
65
66
bool NetworkInfoConnection::metered() const
67
{
68
    if (m_networkInfo)
69
        return m_networkInfo->metered();
70
    
71
    return m_controller->client()->metered();
72
}
73
74
void NetworkInfoConnection::didChangeNetworkInformation(PassRefPtr<Event> event, PassRefPtr<NetworkInfo> networkInfo)
75
{
76
    m_networkInfo = networkInfo;
77
    dispatchEvent(event);
78
}
79
80
EventTargetData* NetworkInfoConnection::eventTargetData()
81
{
82
    return &m_eventTargetData;
83
}
84
85
EventTargetData* NetworkInfoConnection::ensureEventTargetData()
86
{
87
    return &m_eventTargetData;
88
}
89
90
const AtomicString& NetworkInfoConnection::interfaceName() const
91
{
92
    return eventNames().interfaceForNetworkInfoConnection;
93
}
94
95
void NetworkInfoConnection::suspend(ReasonForSuspension)
96
{
97
    if (m_controller)
98
        m_controller->removeListener(this);
99
}
100
101
void NetworkInfoConnection::resume()
102
{
103
    if (m_controller)
104
        m_controller->addListener(this);
105
}
106
107
void NetworkInfoConnection::stop()
108
{
109
    if (m_controller)
110
        m_controller->removeListener(this);
111
}
112
113
} // namespace WebCore
114
#endif
- a/Source/WebCore/Modules/networkinfo/NetworkInfoConnection.h +93 lines
Line 0 a/Source/WebCore/Modules/networkinfo/NetworkInfoConnection.h_sec1
1
/*
2
 * Copyright (C) 2012 Samsung Electronics. All Rights Reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 *
8
 * 1.  Redistributions of source code must retain the above copyright
9
 *     notice, this list of conditions and the following disclaimer.
10
 * 2.  Redistributions in binary form must reproduce the above copyright
11
 *     notice, this list of conditions and the following disclaimer in the
12
 *     documentation and/or other materials provided with the distribution.
13
 * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
14
 *     its contributors may be used to endorse or promote products derived
15
 *     from this software without specific prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
28
29
#ifndef NetworkInfoConnection_h
30
#define NetworkInfoConnection_h
31
32
#if ENABLE(NETWORK_INFO)
33
#include "ActiveDOMObject.h"
34
#include "EventListener.h"
35
#include "EventTarget.h"
36
#include "Navigator.h"
37
#include "NetworkInfo.h"
38
#include "NetworkInfoController.h"
39
#include "PlatformString.h"
40
41
#include <wtf/PassRefPtr.h>
42
#include <wtf/RefCounted.h>
43
44
namespace WebCore {
45
46
class NetworkInfoController;
47
48
class NetworkInfoConnection : public RefCounted<NetworkInfoConnection>, public EventTarget, public ActiveDOMObject {
49
public:
50
    static PassRefPtr<NetworkInfoConnection> create(Navigator*);
51
52
    ~NetworkInfoConnection();
53
54
    unsigned int bandwidth() const;
55
    bool metered() const;
56
    
57
    void didChangeNetworkInformation(PassRefPtr<Event>, PassRefPtr<NetworkInfo>);
58
59
    // EventTarget implementation.
60
    virtual const AtomicString& interfaceName() const;
61
    virtual ScriptExecutionContext* scriptExecutionContext() const { return ActiveDOMObject::scriptExecutionContext(); }
62
63
    using RefCounted<NetworkInfoConnection>::ref;
64
    using RefCounted<NetworkInfoConnection>::deref;
65
66
    DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitnetworkinfochange);
67
  
68
    // ActiveDOMObject implementation.
69
    virtual bool canSuspend() const { return true; }
70
    virtual void suspend(ReasonForSuspension);
71
    virtual void resume();
72
    virtual void stop();
73
74
private:
75
    explicit NetworkInfoConnection(Navigator*);
76
77
    // EventTarget implementation.
78
    virtual EventTargetData* eventTargetData();
79
    virtual EventTargetData* ensureEventTargetData();
80
    virtual void refEventTarget() { ref(); }
81
    virtual void derefEventTarget() { deref(); }
82
83
    // EventTarget implementation.
84
    EventTargetData m_eventTargetData;
85
86
    NetworkInfoController* m_controller;
87
    RefPtr<NetworkInfo> m_networkInfo; 
88
};
89
90
} // namespace WebCore
91
92
#endif
93
#endif // NetworkInfoConnection_h
- a/Source/WebCore/Modules/networkinfo/NetworkInfoConnection.idl +45 lines
Line 0 a/Source/WebCore/Modules/networkinfo/NetworkInfoConnection.idl_sec1
1
/*
2
 * Copyright (C) 2012 Samsung Electronics. All Rights Reserved.
3
 *
4
 * All rights reserved.
5
 *
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Library General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2 of the License, or (at your option) any later version.
10
 *
11
 * This library is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Library General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Library General Public License
17
 * along with this library; see the file COPYING.LIB.  If not, write to
18
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
 * Boston, MA 02110-1301, USA.
20
 */
21
22
module window {
23
24
    // http://dvcs.w3.org/hg/dap/raw-file/tip/network-api/index.html
25
    interface [
26
        Conditional=NETWORK_INFO,
27
        ActiveDOMObject,
28
        EventTarget
29
    ] NetworkInfoConnection {
30
        readonly attribute double bandwidth;
31
        readonly attribute boolean metered;
32
33
        attribute EventListener onwebkitnetworkinfochange;
34
35
        // EventTarget interface
36
        void addEventListener(in DOMString type, 
37
                              in EventListener listener, 
38
                              in [Optional] boolean useCapture);
39
        void removeEventListener(in DOMString type, 
40
                                 in EventListener listener, 
41
                                 in [Optional] boolean useCapture);
42
        boolean dispatchEvent(in Event evt)
43
            raises(EventException);
44
    };
45
}
- a/Source/WebCore/Modules/networkinfo/NetworkInfoController.cpp +91 lines
Line 0 a/Source/WebCore/Modules/networkinfo/NetworkInfoController.cpp_sec1
1
/*
2
 * Copyright (C) 2012 Samsung Electronics. All Rights Reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 *
8
 * 1.  Redistributions of source code must retain the above copyright
9
 *     notice, this list of conditions and the following disclaimer.
10
 * 2.  Redistributions in binary form must reproduce the above copyright
11
 *     notice, this list of conditions and the following disclaimer in the
12
 *     documentation and/or other materials provided with the distribution.
13
 * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
14
 *     its contributors may be used to endorse or promote products derived
15
 *     from this software without specific prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
28
29
#include "config.h"
30
#include "NetworkInfoController.h"
31
32
#if ENABLE(NETWORK_INFO)
33
#include "Event.h"
34
#include "NetworkInfo.h"
35
#include "NetworkInfoClient.h"
36
37
namespace WebCore {
38
39
NetworkInfoController::NetworkInfoController(Page* page, NetworkInfoClient* client)
40
    : m_page(page)
41
    , m_client(client)
42
{
43
}
44
45
NetworkInfoController::~NetworkInfoController()
46
{
47
}
48
49
PassOwnPtr<NetworkInfoController> NetworkInfoController::create(Page* page, NetworkInfoClient* client)
50
{
51
    return adoptPtr(new NetworkInfoController(page, client));
52
}
53
54
void NetworkInfoController::addListener(NetworkInfoConnection* networkInfoConnection)
55
{
56
     m_listeners.append(networkInfoConnection);
57
     m_client->startUpdating();
58
}
59
60
void NetworkInfoController::removeListener(NetworkInfoConnection* networkInfoConnection)
61
{
62
     size_t position = m_listeners.find(networkInfoConnection);
63
     if (position == WTF::notFound)
64
         return;
65
     m_listeners.remove(position);
66
     if (m_listeners.isEmpty())
67
         m_client->stopUpdating();
68
}
69
70
void NetworkInfoController::didChangeNetworkInformation(const AtomicString& eventType, PassRefPtr<NetworkInfo> networkInfo)
71
{
72
     RefPtr<Event> event = Event::create(eventType, false, false);
73
     RefPtr<NetworkInfo> networkInformation = networkInfo;
74
     for (NetworkInfoListenerList::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it)
75
         (*it)->didChangeNetworkInformation(event, networkInformation);
76
}
77
78
const AtomicString& NetworkInfoController::supplementName()
79
{
80
    DEFINE_STATIC_LOCAL(AtomicString, name, ("NetworkInfoController"));
81
    return name;
82
}
83
84
void provideNetworkInfoTo(Page* page, NetworkInfoClient* client)
85
{
86
    NetworkInfoController::provideTo(page, NetworkInfoController::supplementName(), NetworkInfoController::create(page, client));
87
}
88
89
} // namespace WebCore
90
91
#endif
- a/Source/WebCore/Modules/networkinfo/NetworkInfoController.h +68 lines
Line 0 a/Source/WebCore/Modules/networkinfo/NetworkInfoController.h_sec1
1
/*
2
 * Copyright (C) 2012 Samsung Electronics. All Rights Reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
24
 */
25
26
#ifndef NetworkInfoController_h
27
#define NetworkInfoController_h
28
29
#if ENABLE(NETWORK_INFO)
30
#include "NetworkInfoClient.h"
31
#include "NetworkInfoConnection.h"
32
#include "Page.h"
33
34
namespace WebCore {
35
36
class NetworkInfo;
37
class NetworkInfoConnection;
38
39
class NetworkInfoController : public Supplement<Page> {
40
public:
41
    ~NetworkInfoController();
42
43
    NetworkInfoClient* client() { return m_client; }
44
45
    static PassOwnPtr<NetworkInfoController> create(Page*, NetworkInfoClient*);
46
47
    static const AtomicString& supplementName();
48
    static NetworkInfoController* from(Page* page) { return static_cast<NetworkInfoController*>(Supplement<Page>::from(page, supplementName())); }
49
   
50
    void addListener(NetworkInfoConnection*);
51
    void removeListener(NetworkInfoConnection*);
52
53
    void didChangeNetworkInformation(const AtomicString& eventType, PassRefPtr<NetworkInfo>);
54
55
private:
56
    NetworkInfoController(Page*, NetworkInfoClient*);
57
58
    typedef Vector<NetworkInfoConnection*> NetworkInfoListenerList;
59
60
    Page* m_page;
61
    NetworkInfoClient* m_client;
62
    NetworkInfoListenerList m_listeners;
63
};
64
65
}
66
67
#endif // ENABLE(NETWORK_INFO)
68
#endif // NetworkInfoController_h
- a/Source/WebCore/dom/EventNames.h +2 lines
Lines 218-223 namespace WebCore { a/Source/WebCore/dom/EventNames.h_sec1
218
    \
218
    \
219
    macro(webkitRegionLayoutUpdate) \
219
    macro(webkitRegionLayoutUpdate) \
220
    \
220
    \
221
    macro(webkitnetworkinfochange) \
222
    \
221
223
222
// end of DOM_EVENT_NAMES_FOR_EACH
224
// end of DOM_EVENT_NAMES_FOR_EACH
223
225
- a/Source/WebCore/dom/EventTargetFactory.in +1 lines
Lines 18-23 LocalMediaStream conditional=MEDIA_STREAM a/Source/WebCore/dom/EventTargetFactory.in_sec1
18
MediaController conditional=VIDEO
18
MediaController conditional=VIDEO
19
MediaStream conditional=MEDIA_STREAM
19
MediaStream conditional=MEDIA_STREAM
20
MessagePort
20
MessagePort
21
NetworkInfoConnection conditional=NETWORK_INFO
21
Node
22
Node
22
Notification conditional=NOTIFICATIONS|LEGACY_NOTIFICATIONS
23
Notification conditional=NOTIFICATIONS|LEGACY_NOTIFICATIONS
23
PeerConnection00 conditional=MEDIA_STREAM
24
PeerConnection00 conditional=MEDIA_STREAM
- a/Source/WebCore/testing/Internals.cpp +21 lines
Lines 67-72 a/Source/WebCore/testing/Internals.cpp_sec1
67
#include "BatteryController.h"
67
#include "BatteryController.h"
68
#endif
68
#endif
69
69
70
#if ENABLE(NETWORK_INFO)
71
#include "NetworkInfo.h"
72
#include "NetworkInfoController.h"
73
#endif
74
70
#if ENABLE(TOUCH_ADJUSTMENT)
75
#if ENABLE(TOUCH_ADJUSTMENT)
71
#include "EventHandler.h"
76
#include "EventHandler.h"
72
#include "WebKitPoint.h"
77
#include "WebKitPoint.h"
Lines 809-814 void Internals::setBatteryStatus(Document* document, const String& eventType, bo a/Source/WebCore/testing/Internals.cpp_sec2
809
#endif
814
#endif
810
}
815
}
811
816
817
void Internals::setNetworkInformation(Document* document, const String& eventType, long bandwidth, bool metered, ExceptionCode& ec)
818
{
819
    if (!document || !document->page()) {
820
        ec = INVALID_ACCESS_ERR;
821
        return;
822
    }
823
824
#if ENABLE(NETWORK_INFO)
825
    NetworkInfoController::from(document->page())->didChangeNetworkInformation(eventType, NetworkInfo::create(bandwidth, metered));
826
#else
827
    UNUSED_PARAM(eventType);
828
    UNUSED_PARAM(bandwidth);
829
    UNUSED_PARAM(metered);
830
#endif
831
}
832
812
bool Internals::hasSpellingMarker(Document* document, int from, int length, ExceptionCode&)
833
bool Internals::hasSpellingMarker(Document* document, int from, int length, ExceptionCode&)
813
{
834
{
814
    if (!document || !document->frame())
835
    if (!document || !document->frame())
- a/Source/WebCore/testing/Internals.h +2 lines
Lines 152-157 public: a/Source/WebCore/testing/Internals.h_sec1
152
152
153
    void setBatteryStatus(Document*, const String& eventType, bool charging, double chargingTime, double dischargingTime, double level, ExceptionCode&);
153
    void setBatteryStatus(Document*, const String& eventType, bool charging, double chargingTime, double dischargingTime, double level, ExceptionCode&);
154
154
155
    void setNetworkInformation(Document*, const String& eventType, long bandwidth, bool metered, ExceptionCode&);
156
155
#if ENABLE(INSPECTOR)
157
#if ENABLE(INSPECTOR)
156
    unsigned numberOfLiveNodes() const;
158
    unsigned numberOfLiveNodes() const;
157
    unsigned numberOfLiveDocuments() const;
159
    unsigned numberOfLiveDocuments() const;
- a/Source/WebCore/testing/Internals.idl +4 lines
Lines 128-133 module window { a/Source/WebCore/testing/Internals.idl_sec1
128
        void setBatteryStatus(in Document document, in DOMString eventType, in boolean charging, in double chargingTime, in double dischargingTime, in double level) raises (DOMException);
128
        void setBatteryStatus(in Document document, in DOMString eventType, in boolean charging, in double chargingTime, in double dischargingTime, in double level) raises (DOMException);
129
#endif 
129
#endif 
130
130
131
#if defined(ENABLE_NETWORK_INFO) && ENABLE_NETWORK_INFO
132
        void setNetworkInformation(in Document document, in DOMString eventType, in long bandwidth, in boolean metered) raises (DOMException);
133
#endif
134
131
        [Conditional=INSPECTOR] unsigned long numberOfLiveNodes();
135
        [Conditional=INSPECTOR] unsigned long numberOfLiveNodes();
132
        [Conditional=INSPECTOR] unsigned long numberOfLiveDocuments();
136
        [Conditional=INSPECTOR] unsigned long numberOfLiveDocuments();
133
    };
137
    };
- a/Source/WebKit/PlatformEfl.cmake +9 lines
Lines 60-65 IF (WTF_USE_PANGO) a/Source/WebKit/PlatformEfl.cmake_sec1
60
  )
60
  )
61
ENDIF ()
61
ENDIF ()
62
62
63
IF (ENABLE_NETWORK_INFO)
64
  LIST(APPEND WebKit_INCLUDE_DIRECTORIES
65
    "${WEBCORE_DIR}/Modules/networkinfo"
66
  )
67
  LIST(APPEND WebKit_SOURCES
68
    efl/WebCoreSupport/NetworkInfoClientEfl.cpp
69
  )
70
ENDIF ()
71
63
IF (ENABLE_NOTIFICATIONS)
72
IF (ENABLE_NOTIFICATIONS)
64
  LIST(APPEND WebKit_INCLUDE_DIRECTORIES
73
  LIST(APPEND WebKit_INCLUDE_DIRECTORIES
65
    "${WEBCORE_DIR}/notifications"
74
    "${WEBCORE_DIR}/notifications"
- a/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.cpp +70 lines
Line 0 a/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.cpp_sec1
1
/*
2
 * Copyright (C) 2012 Samsung Electronics
3
 *
4
 * All rights reserved.
5
 *
6
 * Redistribution and use in source and binary forms, with or without
7
 * modification, are permitted provided that the following conditions
8
 * are met:
9
 * 1. Redistributions of source code must retain the above copyright
10
 *    notice, this list of conditions and the following disclaimer.
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 *    notice, this list of conditions and the following disclaimer in the
13
 *    documentation and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
16
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
19
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 */
27
28
#include "config.h"
29
#include "NetworkInfoClientEfl.h"
30
31
#if ENABLE(NETWORK_INFO)
32
#include "NetworkInfo.h"
33
#include "NotImplemented.h"
34
#include <wtf/text/CString.h>
35
#include <wtf/text/WTFString.h>
36
37
namespace WebCore {
38
NetworkInfoClientEfl::NetworkInfoClientEfl()
39
    : m_controller(0)
40
{
41
}
42
43
NetworkInfoClientEfl::~NetworkInfoClientEfl()
44
{
45
}
46
47
void NetworkInfoClientEfl::startUpdating()
48
{
49
    notImplemented();
50
}
51
52
void NetworkInfoClientEfl::stopUpdating()
53
{
54
    notImplemented();
55
}
56
57
unsigned int NetworkInfoClientEfl::bandwidth() const
58
{
59
    notImplemented();
60
    return 10; // MB/s
61
}
62
63
bool NetworkInfoClientEfl::metered() const
64
{
65
    notImplemented();
66
    return false;
67
}
68
69
}
70
#endif
- a/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.h +53 lines
Line 0 a/Source/WebKit/efl/WebCoreSupport/NetworkInfoClientEfl.h_sec1
1
/*
2
 * Copyright (C) 2012 Samsung Electronics
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 *
8
 * 1.  Redistributions of source code must retain the above copyright
9
 *     notice, this list of conditions and the following disclaimer.
10
 * 2.  Redistributions in binary form must reproduce the above copyright
11
 *     notice, this list of conditions and the following disclaimer in the
12
 *     documentation and/or other materials provided with the distribution.
13
 * 3.  Neither the name of Apple, Inc. ("Apple") nor the names of
14
 *     its contributors may be used to endorse or promote products derived
15
 *     from this software without specific prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
28
29
#ifndef NetworkInfoClientEfl_h
30
#define NetworkInfoClientEfl_h
31
32
#include "NetworkInfoClient.h"
33
#include "NetworkInfoController.h"
34
35
namespace WebCore {
36
class NetworkInfoClientEfl : public WebCore::NetworkInfoClient {
37
public:
38
    NetworkInfoClientEfl();
39
    ~NetworkInfoClientEfl();
40
    
41
    virtual void startUpdating();
42
    virtual void stopUpdating();
43
44
    virtual unsigned int bandwidth() const;
45
    virtual bool metered() const;
46
47
private:
48
49
    NetworkInfoController* m_controller;
50
};
51
}
52
53
#endif // NetworkInfoClientEfl_h
- a/Source/WebKit/efl/ewk/ewk_view.cpp +8 lines
Lines 83-88 a/Source/WebKit/efl/ewk/ewk_view.cpp_sec1
83
#include "NotImplemented.h"
83
#include "NotImplemented.h"
84
#endif
84
#endif
85
85
86
#if ENABLE(NETWORK_INFO)
87
#include "NetworkInfoClientEfl.h"
88
#endif
89
86
static const float zoomMinimum = 0.05;
90
static const float zoomMinimum = 0.05;
87
static const float zoomMaximum = 4.0;
91
static const float zoomMaximum = 4.0;
88
92
Lines 624-629 static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* smartData) a/Source/WebKit/efl/ewk/ewk_view.cpp_sec2
624
    WebCore::provideDeviceOrientationTo(priv->page.get(), new WebCore::DeviceOrientationClientEfl);
628
    WebCore::provideDeviceOrientationTo(priv->page.get(), new WebCore::DeviceOrientationClientEfl);
625
#endif
629
#endif
626
630
631
#if ENABLE(NETWORK_INFO)
632
    WebCore::provideNetworkInfoTo(priv->page.get(), new WebCore::NetworkInfoClientEfl);
633
#endif
634
627
#if ENABLE(VIBRATION)
635
#if ENABLE(VIBRATION)
628
    WebCore::provideVibrationTo(priv->page.get(), new WebCore::VibrationClientEfl(smartData->self));
636
    WebCore::provideVibrationTo(priv->page.get(), new WebCore::VibrationClientEfl(smartData->self));
629
#endif
637
#endif
- a/Source/cmake/OptionsEfl.cmake +1 lines
Lines 87-92 WEBKIT_FEATURE(ENABLE_METER_TAG "Enable Meter tag" DEFAULT ON) a/Source/cmake/OptionsEfl.cmake_sec1
87
WEBKIT_FEATURE(ENABLE_MICRODATA "Enable HTML5 microdata support" DEFAULT OFF)
87
WEBKIT_FEATURE(ENABLE_MICRODATA "Enable HTML5 microdata support" DEFAULT OFF)
88
WEBKIT_FEATURE(ENABLE_MUTATION_OBSERVERS "Enable HTML5 mutation observers support" DEFAULT ON)
88
WEBKIT_FEATURE(ENABLE_MUTATION_OBSERVERS "Enable HTML5 mutation observers support" DEFAULT ON)
89
WEBKIT_FEATURE(ENABLE_NETSCAPE_PLUGIN_API "Enable Netscape plugin API" DEFAULT OFF)
89
WEBKIT_FEATURE(ENABLE_NETSCAPE_PLUGIN_API "Enable Netscape plugin API" DEFAULT OFF)
90
WEBKIT_FEATURE(ENABLE_NETWORK_INFO "Enable Network Information API" DEFAULT ON)
90
WEBKIT_FEATURE(ENABLE_NOTIFICATIONS "Enable notifications" DEFAULT OFF)
91
WEBKIT_FEATURE(ENABLE_NOTIFICATIONS "Enable notifications" DEFAULT OFF)
91
WEBKIT_FEATURE(ENABLE_ORIENTATION_EVENTS "Enable orientation events" DEFAULT OFF)
92
WEBKIT_FEATURE(ENABLE_ORIENTATION_EVENTS "Enable orientation events" DEFAULT OFF)
92
WEBKIT_FEATURE(ENABLE_PAGE_VISIBILITY_API "Enable Page Visibility API" DEFAULT ON)
93
WEBKIT_FEATURE(ENABLE_PAGE_VISIBILITY_API "Enable Page Visibility API" DEFAULT ON)
- a/Source/cmakeconfig.h.cmake +1 lines
Lines 31-36 a/Source/cmakeconfig.h.cmake_sec1
31
#cmakedefine01 ENABLE_MICRODATA
31
#cmakedefine01 ENABLE_MICRODATA
32
#cmakedefine01 ENABLE_MUTATION_OBSERVERS
32
#cmakedefine01 ENABLE_MUTATION_OBSERVERS
33
#cmakedefine01 ENABLE_NETSCAPE_PLUGIN_API
33
#cmakedefine01 ENABLE_NETSCAPE_PLUGIN_API
34
#cmakedefine01 ENABLE_NETWORK_INFO
34
#cmakedefine01 ENABLE_NOTIFICATIONS
35
#cmakedefine01 ENABLE_NOTIFICATIONS
35
#cmakedefine01 ENABLE_ORIENTATION_EVENTS
36
#cmakedefine01 ENABLE_ORIENTATION_EVENTS
36
#cmakedefine01 ENABLE_PAGE_VISIBILITY_API
37
#cmakedefine01 ENABLE_PAGE_VISIBILITY_API
- a/Tools/ChangeLog +11 lines
Lines 1-3 a/Tools/ChangeLog_sec1
1
2012-03-28  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
2
3
        Support the Network Information API
4
        https://bugs.webkit.org/show_bug.cgi?id=73528
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Add network information API feature to build script.
9
10
        * Scripts/build-webkit:
11
1
2012-03-28  Mark Rowe  <mrowe@apple.com>
12
2012-03-28  Mark Rowe  <mrowe@apple.com>
2
13
3
        Fix --no-saved-state.
14
        Fix --no-saved-state.
- a/Tools/Scripts/build-webkit +4 lines
Lines 114-119 my ( a/Tools/Scripts/build-webkit_sec1
114
    $microdataSupport,
114
    $microdataSupport,
115
    $mutationObserversSupport,
115
    $mutationObserversSupport,
116
    $netscapePluginSupport,
116
    $netscapePluginSupport,
117
    $networkInfoSupport,
117
    $notificationsSupport,
118
    $notificationsSupport,
118
    $orientationEventsSupport,
119
    $orientationEventsSupport,
119
    $pageVisibilityApiSupport,
120
    $pageVisibilityApiSupport,
Lines 290-295 my @features = ( a/Tools/Scripts/build-webkit_sec2
290
    { option => "netscape-plugin", desc => "Netscape Plugin support",
291
    { option => "netscape-plugin", desc => "Netscape Plugin support",
291
      define => "ENABLE_NETSCAPE_PLUGIN_API", default => !isEfl(), value => \$netscapePluginSupport },
292
      define => "ENABLE_NETSCAPE_PLUGIN_API", default => !isEfl(), value => \$netscapePluginSupport },
292
293
294
    { option => "network-info", desc => "Network Information API support",
295
      define => "ENABLE_NETWORK_INFO", default => isEfl(), value => \$networkInfoSupport },
296
293
    { option => "notifications", desc => "Toggle Desktop Notifications Support",
297
    { option => "notifications", desc => "Toggle Desktop Notifications Support",
294
      define => "ENABLE_NOTIFICATIONS", default => isBlackBerry(), value => \$notificationsSupport },
298
      define => "ENABLE_NOTIFICATIONS", default => isBlackBerry(), value => \$notificationsSupport },
295
299
- a/LayoutTests/ChangeLog +52 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2012-03-28  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
2
3
        Support the Network Information API
4
        https://bugs.webkit.org/show_bug.cgi?id=73528
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Add new test cases for network information API specification.
9
        And also, skip this test cases for other ports.
10
11
        * networkinformation/add-listener-from-callback-expected.txt: Added.
12
        * networkinformation/add-listener-from-callback.html: Added.
13
        * networkinformation/basic-all-types-of-events-expected.txt: Added.
14
        * networkinformation/basic-all-types-of-events.html: Added.
15
        * networkinformation/basic-operation-expected.txt: Added.
16
        * networkinformation/basic-operation.html: Added.
17
        * networkinformation/event-after-navigation-expected.txt: Added.
18
        * networkinformation/event-after-navigation.html: Added.
19
        * networkinformation/multiple-frames-expected.txt: Added.
20
        * networkinformation/multiple-frames.html: Added.
21
        * networkinformation/resources/event-after-navigation-new.html: Added.
22
        * networkinformation/script-tests/add-listener-from-callback.js: Added.
23
        (checkNetworkInformation):
24
        (firstListener):
25
        (secondListener):
26
        (maybeFinishTest):
27
        * networkinformation/script-tests/basic-all-types-of-events.js: Added.
28
        (checkNetworkInformation):
29
        * networkinformation/script-tests/basic-operation.js: Added.
30
        * networkinformation/script-tests/event-after-navigation.js: Added.
31
        * networkinformation/script-tests/multiple-frames.js: Added.
32
        (checkNetworkInformation):
33
        (checkChildNetworkInformation):
34
        (mainFrameListener):
35
        (childFrameListener):
36
        (maybeFinishTest):
37
        * networkinformation/script-tests/updates.js: Added.
38
        (checkNetworkInformation):
39
        (setNetworkInformation):
40
        (firstListener):
41
        (updateListener):
42
        * networkinformation/script-tests/window-property.js: Added.
43
        (hasOnConnectionProperty):
44
        * networkinformation/updates-expected.txt: Added.
45
        * networkinformation/updates.html: Added.
46
        * networkinformation/window-property-expected.txt: Added.
47
        * networkinformation/window-property.html: Added.
48
        * platform/gtk/Skipped:
49
        * platform/mac/Skipped:
50
        * platform/qt/Skipped:
51
        * platform/wincairo/Skipped:
52
1
2012-03-28  Li Yin  <li.yin@intel.com>
53
2012-03-28  Li Yin  <li.yin@intel.com>
2
54
3
        [WebSocket]Browser must fail connection if Sec-WebSocket-Protocol mismatched.
55
        [WebSocket]Browser must fail connection if Sec-WebSocket-Protocol mismatched.
- a/LayoutTests/networkinformation/add-listener-from-callback-expected.txt +15 lines
Line 0 a/LayoutTests/networkinformation/add-listener-from-callback-expected.txt_sec1
1
Tests that adding a new event listener from a callback works as expected.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
PASS connection.bandwidth is bandwidth
7
PASS connection.metered is metered
8
PASS connection.bandwidth is bandwidth
9
PASS connection.metered is metered
10
PASS connection.bandwidth is bandwidth
11
PASS connection.metered is metered
12
PASS successfullyParsed is true
13
14
TEST COMPLETE
15
- a/LayoutTests/networkinformation/add-listener-from-callback.html +9 lines
Line 0 a/LayoutTests/networkinformation/add-listener-from-callback.html_sec1
1
<html>
2
<head>
3
<script src="../fast/js/resources/js-test-pre.js"></script>
4
</head>
5
<body>
6
<script src="script-tests/add-listener-from-callback.js"></script>
7
<script src="../fast/js/resources/js-test-post.js"></script>
8
</body>
9
</html>
- a/LayoutTests/networkinformation/basic-all-types-of-events-expected.txt +12 lines
Line 0 a/LayoutTests/networkinformation/basic-all-types-of-events-expected.txt_sec1
1
Tests the basic operation of all NetworkInfo events.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
webkitnetworkinfochange event is raised
7
PASS connection.bandwidth is bandwidth
8
PASS connection.metered is metered
9
PASS successfullyParsed is true
10
11
TEST COMPLETE
12
- a/LayoutTests/networkinformation/basic-all-types-of-events.html +9 lines
Line 0 a/LayoutTests/networkinformation/basic-all-types-of-events.html_sec1
1
<html>
2
<head>
3
<script src="../fast/js/resources/js-test-pre.js"></script>
4
</head>
5
<body>
6
<script src="script-tests/basic-all-types-of-events.js"></script>
7
<script src="../fast/js/resources/js-test-post.js"></script>
8
</body>
9
</html>
- a/LayoutTests/networkinformation/basic-operation-expected.txt +11 lines
Line 0 a/LayoutTests/networkinformation/basic-operation-expected.txt_sec1
1
Tests the basic operation of NetworkInfo.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
PASS connection.bandwidth is bandwidth
7
PASS connection.metered is metered
8
PASS successfullyParsed is true
9
10
TEST COMPLETE
11
- a/LayoutTests/networkinformation/basic-operation.html +9 lines
Line 0 a/LayoutTests/networkinformation/basic-operation.html_sec1
1
<html>
2
<head>
3
<script src="../fast/js/resources/js-test-pre.js"></script>
4
</head>
5
<body>
6
<script src="script-tests/basic-operation.js"></script>
7
<script src="../fast/js/resources/js-test-post.js"></script>
8
</body>
9
</html>
- a/LayoutTests/networkinformation/event-after-navigation-expected.txt +3 lines
Line 0 a/LayoutTests/networkinformation/event-after-navigation-expected.txt_sec1
1
Tests for a crash where an event is fired after the page has been navigated away when the original page is in the page cache.
2
3
SUCCESS
- a/LayoutTests/networkinformation/event-after-navigation.html +9 lines
Line 0 a/LayoutTests/networkinformation/event-after-navigation.html_sec1
1
<html>
2
<head>
3
<script src="../fast/js/resources/js-test-pre.js"></script>
4
</head>
5
<body>
6
<script src="script-tests/event-after-navigation.js"></script>
7
<script src="../fast/js/resources/js-test-post.js"></script>
8
</body>
9
</html>
- a/LayoutTests/networkinformation/multiple-frames-expected.txt +13 lines
Line 0 a/LayoutTests/networkinformation/multiple-frames-expected.txt_sec1
1
Tests using NetworkInfo from multiple frames.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
PASS connection.bandwidth is bandwidth
7
PASS connection.metered is metered
8
PASS connection.bandwidth is bandwidth
9
PASS connection.metered is metered
10
PASS successfullyParsed is true
11
12
TEST COMPLETE
13
- a/LayoutTests/networkinformation/multiple-frames.html +9 lines
Line 0 a/LayoutTests/networkinformation/multiple-frames.html_sec1
1
<html>
2
<head>
3
<script src="../fast/js/resources/js-test-pre.js"></script>
4
</head>
5
<body>
6
<script src="script-tests/multiple-frames.js"></script>
7
<script src="../fast/js/resources/js-test-post.js"></script>
8
</body>
9
</html>
- a/LayoutTests/networkinformation/resources/event-after-navigation-new.html +13 lines
Line 0 a/LayoutTests/networkinformation/resources/event-after-navigation-new.html_sec1
1
<html>
2
  <head>
3
  </head>
4
  <body>
5
    Tests for a crash where an event is fired after the page has been navigated
6
    away when the original page is in the page cache.<br><br>
7
    SUCCESS
8
    <script>
9
        internals.setNetworkInformation(document, 'webkitnetworkinfochange', 100, true);
10
        layoutTestController.notifyDone();
11
    </script>
12
  </body>
13
</html>
- a/LayoutTests/networkinformation/script-tests/add-listener-from-callback.js +41 lines
Line 0 a/LayoutTests/networkinformation/script-tests/add-listener-from-callback.js_sec1
1
description('Tests that adding a new event listener from a callback works as expected.');
2
3
var bandwidth = 10;
4
var metered = false;
5
6
var connection = navigator.webkitConnection;
7
8
function checkNetworkInformation() {
9
    shouldBe('connection.bandwidth', 'bandwidth');
10
    shouldBe('connection.metered', 'metered');
11
}
12
13
var firstListenerEvents = 0;
14
function firstListener() {
15
    checkNetworkInformation();
16
    if (++firstListenerEvents == 1) {
17
        connection.addEventListener('webkitnetworkinfochange', secondListener);
18
        internals.setNetworkInformation(document, 'webkitnetworkinfochange', bandwidth, metered);
19
    }
20
    else if (firstListenerEvents > 2)
21
        testFailed('Too many events for first listener.');
22
    maybeFinishTest();
23
}
24
25
var secondListenerEvents = 0;
26
function secondListener() {
27
    checkNetworkInformation();
28
    if (++secondListenerEvents > 1)
29
        testFailed('Too many events for second listener.');
30
    maybeFinishTest();
31
}
32
33
function maybeFinishTest() {
34
    if (firstListenerEvents == 2 && secondListenerEvents == 1)
35
        finishJSTest();
36
}
37
38
connection.addEventListener('webkitnetworkinfochange', firstListener);
39
internals.setNetworkInformation(document, 'webkitnetworkinfochange', bandwidth, metered);
40
41
window.jsTestIsAsync = true;
- a/LayoutTests/networkinformation/script-tests/basic-all-types-of-events.js +20 lines
Line 0 a/LayoutTests/networkinformation/script-tests/basic-all-types-of-events.js_sec1
1
description('Tests the basic operation of all NetworkInfo events.');
2
3
var bandwidth = 10;
4
var metered = false;
5
6
var connection = navigator.webkitConnection;
7
8
function checkNetworkInformation() {
9
    shouldBe('connection.bandwidth', 'bandwidth');
10
    shouldBe('connection.metered', 'metered');
11
}
12
13
connection.addEventListener('webkitnetworkinfochange', function() {
14
    debug('webkitnetworkinfochange event is raised');
15
    checkNetworkInformation();
16
    finishJSTest();
17
});
18
19
internals.setNetworkInformation(document, 'webkitnetworkinfochange', bandwidth, metered);
20
window.jsTestIsAsync = true;
- a/LayoutTests/networkinformation/script-tests/basic-operation.js +16 lines
Line 0 a/LayoutTests/networkinformation/script-tests/basic-operation.js_sec1
1
description('Tests the basic operation of NetworkInfo.');
2
3
var bandwidth = 10;
4
var metered = false;
5
6
var connection = navigator.webkitConnection;
7
8
connection.addEventListener('webkitnetworkinfochange', function() {
9
    shouldBe('connection.bandwidth', 'bandwidth');
10
    shouldBe('connection.metered', 'metered');
11
    finishJSTest();
12
});
13
14
internals.setNetworkInformation(document, 'webkitnetworkinfochange', bandwidth, metered);
15
16
window.jsTestIsAsync = true;
- a/LayoutTests/networkinformation/script-tests/event-after-navigation.js +13 lines
Line 0 a/LayoutTests/networkinformation/script-tests/event-after-navigation.js_sec1
1
description('Tests for a crash where an event is fired after the page has been navigated away when the original page is in the page cache.');
2
3
if (window.layoutTestController)
4
    layoutTestController.overridePreference('WebKitUsesPageCachePreferenceKey', 1);
5
else
6
    debug('This test can not be run without the LayoutTestController');
7
8
document.body.onload = function() {
9
    navigator.webkitConnection.addEventListener('webkitnetworkinfochange', function() { } );
10
    window.location = "resources/event-after-navigation-new.html";
11
}
12
13
window.jsTestIsAsync = true;
- a/LayoutTests/networkinformation/script-tests/multiple-frames.js +45 lines
Line 0 a/LayoutTests/networkinformation/script-tests/multiple-frames.js_sec1
1
description('Tests using NetworkInfo from multiple frames.');
2
3
var bandwidth = 10;
4
var metered = false;
5
6
var connection = navigator.webkitConnection;
7
8
function checkNetworkInformation() {
9
    shouldBe('connection.bandwidth', 'bandwidth');
10
    shouldBe('connection.metered', 'metered');
11
}
12
13
function checkChildNetworkInformation() {
14
    shouldBe('connection.bandwidth', 'bandwidth');
15
    shouldBe('connection.metered', 'metered');
16
}
17
18
var hasMainFrameEventFired = false;
19
function mainFrameListener() {
20
    hasMainFrameEventFired = true;
21
    maybeFinishTest();
22
}
23
24
var hasChildFrameEventFired = false;
25
function childFrameListener() {
26
    hasChildFrameEventFired = true;
27
    maybeFinishTest();
28
}
29
30
function maybeFinishTest() {
31
    if (hasMainFrameEventFired && hasChildFrameEventFired) {
32
        checkNetworkInformation();
33
        checkChildNetworkInformation();
34
        finishJSTest();
35
    }
36
}
37
38
var childFrame = document.createElement('iframe');
39
document.body.appendChild(childFrame);
40
var childConnection = childFrame.contentWindow.navigator.webkitConnection
41
childConnection.addEventListener('webkitnetworkinfochange', childFrameListener);
42
connection.addEventListener('webkitnetworkinfochange', mainFrameListener);
43
44
internals.setNetworkInformation(document, 'webkitnetworkinfochange', bandwidth, metered);
45
window.jsTestIsAsync = true;
- a/LayoutTests/networkinformation/script-tests/updates.js +34 lines
Line 0 a/LayoutTests/networkinformation/script-tests/updates.js_sec1
1
description('Tests that updates to the connection event causes new events to fire.');
2
3
var bandwidth = 10;
4
var metered = false;
5
6
var connection = navigator.webkitConnection;
7
8
function checkNetworkInformation() {
9
    shouldBe('connection.bandwidth', 'bandwidth');
10
    shouldBe('connection.metered', 'metered');
11
}
12
13
function setNetworkInformation() {
14
    internals.setNetworkInformation(document, 'webkitnetworkinfochange', bandwidth, metered);
15
}
16
17
function firstListener() {
18
    checkNetworkInformation();
19
    connection.removeEventListener('webkitnetworkinfochange', firstListener);
20
    connection.addEventListener('webkitnetworkinfochange', updateListener);
21
  
22
    bandwidth = 5;
23
    metered = true;
24
    setNetworkInformation();
25
}
26
27
function updateListener(event) {
28
    checkNetworkInformation(event);
29
    finishJSTest();
30
}
31
32
connection.addEventListener('webkitnetworkinfochange', firstListener);
33
setNetworkInformation();
34
window.jsTestIsAsync = true;
- a/LayoutTests/networkinformation/script-tests/window-property.js +17 lines
Line 0 a/LayoutTests/networkinformation/script-tests/window-property.js_sec1
1
description('Tests that the window.navigator.connection properties are present.');
2
3
function hasOnConnectionProperty()
4
{
5
    var result = 0;
6
    for (var property in navigator.webkitConnection) {
7
        if (property == 'onwebkitnetworkinfochange')
8
            result += 1;
9
    }
10
    if (result == 1)
11
        return true;
12
    return false;
13
}
14
15
shouldBeTrue("typeof navigator.webkitConnection == 'object'");
16
shouldBeTrue("hasOnConnectionProperty()");
17
shouldBeTrue("navigator.webkitConnection.hasOwnProperty('onwebkitnetworkinfochange')");
- a/LayoutTests/networkinformation/updates-expected.txt +13 lines
Line 0 a/LayoutTests/networkinformation/updates-expected.txt_sec1
1
Tests that updates to the connection event causes new events to fire.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
PASS connection.bandwidth is bandwidth
7
PASS connection.metered is metered
8
PASS connection.bandwidth is bandwidth
9
PASS connection.metered is metered
10
PASS successfullyParsed is true
11
12
TEST COMPLETE
13
- a/LayoutTests/networkinformation/updates.html +9 lines
Line 0 a/LayoutTests/networkinformation/updates.html_sec1
1
<html>
2
<head>
3
<script src="../fast/js/resources/js-test-pre.js"></script>
4
</head>
5
<body>
6
<script src="script-tests/updates.js"></script>
7
<script src="../fast/js/resources/js-test-post.js"></script>
8
</body>
9
</html>
- a/LayoutTests/networkinformation/window-property-expected.txt +12 lines
Line 0 a/LayoutTests/networkinformation/window-property-expected.txt_sec1
1
Tests that the window.navigator.connection properties are present.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
PASS typeof navigator.webkitConnection == 'object' is true
7
PASS hasOnConnectionProperty() is true
8
PASS navigator.webkitConnection.hasOwnProperty('onwebkitnetworkinfochange') is true
9
PASS successfullyParsed is true
10
11
TEST COMPLETE
12
- a/LayoutTests/networkinformation/window-property.html +9 lines
Line 0 a/LayoutTests/networkinformation/window-property.html_sec1
1
<html>
2
<head>
3
<script src="../fast/js/resources/js-test-pre.js"></script>
4
</head>
5
<body>
6
<script src="script-tests/window-property.js"></script>
7
<script src="../fast/js/resources/js-test-post.js"></script>
8
</body>
9
</html>
- a/LayoutTests/platform/chromium/test_expectations.txt +3 lines
Lines 142-147 BUGWK62698 SKIP : batterystatus = PASS FAIL a/LayoutTests/platform/chromium/test_expectations.txt_sec1
142
// Touch Adjustment is not supported yet in the chromium port.
142
// Touch Adjustment is not supported yet in the chromium port.
143
BUGWK78801 SKIP : touchadjustment/ = FAIL
143
BUGWK78801 SKIP : touchadjustment/ = FAIL
144
144
145
// Network Information API is not supported yet in the chromium port.
146
BUGWK73528 SKIP : networkinformation = PASS FAIL
147
145
// -----------------------------------------------------------------
148
// -----------------------------------------------------------------
146
// WONTFIX TESTS
149
// WONTFIX TESTS
147
// -----------------------------------------------------------------
150
// -----------------------------------------------------------------
- a/LayoutTests/platform/gtk/Skipped +3 lines
Lines 435-440 pointer-lock/ a/LayoutTests/platform/gtk/Skipped_sec1
435
#Battery Status API support not yet. http://webkit.org/b/62698
435
#Battery Status API support not yet. http://webkit.org/b/62698
436
batterystatus
436
batterystatus
437
437
438
#Network Information API support not yet. http://webkit.org/b/73528
439
networkinformation
440
438
###############################################################################
441
###############################################################################
439
# TESTS FAILING
442
# TESTS FAILING
440
###############################################################################
443
###############################################################################
- a/LayoutTests/platform/mac/Skipped +3 lines
Lines 584-589 canvas/philip/tests/2d.shadow.image.transparent.2.html a/LayoutTests/platform/mac/Skipped_sec1
584
# Needs BatteryClient implementation.
584
# Needs BatteryClient implementation.
585
batterystatus/
585
batterystatus/
586
586
587
#Network Information is not supported yet. http://webkit.org/b/73528
588
networkinformation
589
587
# https://bugs.webkit.org/show_bug.cgi?id=43022
590
# https://bugs.webkit.org/show_bug.cgi?id=43022
588
tables/mozilla_expected_failures/bugs/bug85016.html
591
tables/mozilla_expected_failures/bugs/bug85016.html
589
592
- a/LayoutTests/platform/qt/Skipped +3 lines
Lines 380-385 fast/dom/navigator-vibration.html a/LayoutTests/platform/qt/Skipped_sec1
380
#Battery Status API is not implemented.
380
#Battery Status API is not implemented.
381
batterystatus
381
batterystatus
382
382
383
# Network Information API is not supported yet. http://webkit.org/b/73528
384
networkinformation
385
383
# =========================================================================== #
386
# =========================================================================== #
384
#       Drag and Drop Support in DRT.                                         #
387
#       Drag and Drop Support in DRT.                                         #
385
# =========================================================================== #
388
# =========================================================================== #
- a/LayoutTests/platform/wincairo/Skipped +3 lines
Lines 2074-2076 fast/dom/navigator-vibration.html a/LayoutTests/platform/wincairo/Skipped_sec1
2074
2074
2075
#Battery Status API is not implemented.
2075
#Battery Status API is not implemented.
2076
batterystatus
2076
batterystatus
2077
2078
# Network Information API is not supported yet. http://webkit.org/b/73528
2079
networkinformation
- a/ChangeLog +12 lines
Lines 1-3 a/ChangeLog_sec1
1
2012-03-28  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
2
3
        Support the Network Information API
4
        https://bugs.webkit.org/show_bug.cgi?id=73528
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Add network information API feature.
9
10
        * Source/cmake/OptionsEfl.cmake: Add NETWORK_INFO feature.
11
        * Source/cmakeconfig.h.cmake: Add NETWORK_INFO feature.
12
1
2012-03-28  Kevin Ollivier  <kevino@theolliviers.com>
13
2012-03-28  Kevin Ollivier  <kevino@theolliviers.com>
2
14
3
        [wx] Unreviewed. Build fix, move WTF back into JSCore target
15
        [wx] Unreviewed. Build fix, move WTF back into JSCore target

Return to Bug 73528