Source/WebCore/ChangeLog

 12011-11-23 Greg Billock <gbillock@google.com>
 2
 3 WebCore implementation of the Intent object
 4 See http://dvcs.w3.org/hg/web-intents/raw-file/tip/spec/Overview.html
 5 for draft spec.
 6
 7 https://bugs.webkit.org/show_bug.cgi?id=73051
 8
 9 Reviewed by NOBODY (OOPS!).
 10
 11 Test: web-intents/web-intents-api.html
 12
 13 * WebCore.gypi:
 14 * page/DOMWindow.idl:
 15 * Modules/intents/Intent.cpp: Added.
 16 (WebCore::Intent::Intent):
 17 (WebCore::Intent::action):
 18 (WebCore::Intent::setAction):
 19 (WebCore::Intent::type):
 20 (WebCore::Intent::setType):
 21 (WebCore::Intent::data):
 22 (WebCore::Intent::setData):
 23 (WebCore::Intent::create):
 24 * Modules/intents/Intent.h: Added.
 25 * Modules/intents/Intent.idl: Added.
 26
1272012-01-05 Adam Barth <abarth@webkit.org>
228
329 Introduce Platform namespace for WebCore/platform

Source/WebKit/chromium/ChangeLog

 12011-11-23 Greg Billock <gbillock@google.com>
 2
 3 [Web Intents] Flagged-off WebCore implementation of navigator.startActivity
 4 https://bugs.webkit.org/show_bug.cgi?id=73051
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * features.gypi:
 9
1102012-01-05 W. James MacLean <wjmaclean@chromium.org>
211
312 [chromium][aura] WebExternalTextureLayerImpl::drawsContent() returns incorrect value, causing accelerated content to not display in Aura desktop

Source/WebCore/Modules/intents/Intent.cpp

 1/*
 2 * Copyright (C) 2011 Google Inc. 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 Google, Inc. ("Google") 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 GOOGLE 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 "Intent.h"
 31
 32#if ENABLE(WEB_INTENTS)
 33
 34#include "ExceptionCode.h"
 35#include "SerializedScriptValue.h"
 36
 37namespace WebCore {
 38
 39PassRefPtr<Intent> Intent::create(const String& action, const String& type, PassRefPtr<SerializedScriptValue> data, ExceptionCode& ec)
 40{
 41 if (action.isEmpty()) {
 42 ec = SYNTAX_ERR;
 43 return 0;
 44 }
 45 if (type.isEmpty()) {
 46 ec = SYNTAX_ERR;
 47 return 0;
 48 }
 49
 50 return adoptRef(new Intent(action, type, data));
 51}
 52
 53Intent::Intent(const String& action, const String& type, PassRefPtr<SerializedScriptValue> data)
 54 : m_action(action)
 55 , m_type(type)
 56 , m_identifier(0)
 57{
 58 setData(data.get());
 59}
 60
 61const String& Intent::action() const
 62{
 63 return m_action;
 64}
 65
 66const String& Intent::type() const
 67{
 68 return m_type;
 69}
 70
 71SerializedScriptValue* Intent::data() const
 72{
 73 return m_data.get();
 74}
 75
 76void Intent::setData(SerializedScriptValue* data)
 77{
 78 if (data)
 79 m_data = SerializedScriptValue::createFromWire(data->toWireString());
 80 else
 81 m_data = SerializedScriptValue::nullValue();
 82}
 83
 84int Intent::identifier() const
 85{
 86 return m_identifier;
 87}
 88
 89void Intent::setIdentifier(int id)
 90{
 91 m_identifier = id;
 92}
 93
 94} // namespace WebCore
 95
 96#endif // ENABLE(WEB_INTENTS)

Source/WebCore/Modules/intents/Intent.h

 1/*
 2 * Copyright (C) 2011 Google Inc. 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 Google, Inc. ("Google") 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 GOOGLE 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 Intent_h
 30#define Intent_h
 31
 32#if ENABLE(WEB_INTENTS)
 33
 34#include <wtf/Forward.h>
 35#include <wtf/PassRefPtr.h>
 36#include <wtf/RefCounted.h>
 37#include <wtf/RefPtr.h>
 38#include <wtf/text/WTFString.h>
 39
 40namespace WebCore {
 41
 42class SerializedScriptValue;
 43
 44typedef int ExceptionCode;
 45
 46class Intent : public RefCounted<Intent> {
 47public:
 48 static PassRefPtr<Intent> create(const String& action, const String& type, PassRefPtr<SerializedScriptValue> data, ExceptionCode&);
 49
 50 const String& action() const;
 51 const String& type() const;
 52 SerializedScriptValue* data() const;
 53
 54 int identifier() const;
 55 void setIdentifier(int);
 56
 57private:
 58 Intent(const String& action, const String& type, PassRefPtr<SerializedScriptValue> data);
 59
 60 void setData(SerializedScriptValue*);
 61
 62 String m_action;
 63 String m_type;
 64 RefPtr<SerializedScriptValue> m_data;
 65 int m_identifier;
 66};
 67
 68} // namespace WebCore
 69
 70#endif
 71
 72#endif // Intent_h

Source/WebCore/Modules/intents/Intent.idl

 1/*
 2 * Copyright (C) 2011 Google Inc. 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 *
 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26module window {
 27 interface [
 28 Conditional=WEB_INTENTS,
 29 Constructor(in DOMString action, in DOMString type, in [Optional=CallWithNullValue] SerializedScriptValue data),
 30 ConstructorRaisesException
 31 ] Intent {
 32 readonly attribute DOMString action;
 33 readonly attribute DOMString type;
 34 readonly attribute SerializedScriptValue data;
 35 };
 36}

Source/WebCore/WebCore.gyp/WebCore.gyp

5151 '../',
5252 '../..',
5353 '../Modules/gamepad',
 54 '../Modules/intents',
5455 '../accessibility',
5556 '../accessibility/chromium',
5657 '../bindings',

Source/WebCore/WebCore.gypi

11481148 'Modules/gamepad/Gamepad.idl',
11491149 'Modules/gamepad/GamepadList.idl',
11501150 'Modules/gamepad/NavigatorGamepad.idl',
 1151 'Modules/intents/Intent.idl',
11511152 'css/CSSCharsetRule.idl',
11521153 'css/CSSFontFaceRule.idl',
11531154 'css/CSSImportRule.idl',

16941695 'Modules/gamepad/GamepadList.h',
16951696 'Modules/gamepad/NavigatorGamepad.cpp',
16961697 'Modules/gamepad/NavigatorGamepad.h',
 1698 'Modules/intents/Intent.cpp',
 1699 'Modules/intents/Intent.h',
16971700 'accessibility/AXObjectCache.cpp',
16981701 'accessibility/AccessibilityARIAGrid.cpp',
16991702 'accessibility/AccessibilityARIAGrid.h',

Source/WebCore/page/DOMWindow.idl

@@module window {
607607 attribute [EnabledAtRuntime=webkitVideoTrack] TrackEventConstructor TrackEvent;
608608#endif
609609
 610 attribute [Conditional=WEB_INTENTS] IntentConstructor Intent; // Usable with the new operator
 611
610612 attribute DOMPluginConstructor Plugin;
611613 attribute DOMPluginArrayConstructor PluginArray;
612614

Source/WebKit/chromium/features.gypi

159159 'ENABLE_REGISTER_PROTOCOL_HANDLER=1',
160160 ],
161161 }],
 162 ['enable_web_intents==1', {
 163 'feature_defines': [
 164 'ENABLE_WEB_INTENTS=1',
 165 ],
 166 }],
162167 ['OS=="mac"', {
163168 'feature_defines': [
164169 'ENABLE_RUBBER_BANDING=1',

LayoutTests/platform/efl/Skipped

@@http/tests/websocket/tests/hybi/
19281928# Microdata DOM API is not yet enabled.
19291929fast/dom/MicroData
19301930
 1931# Web Intents is not yet enabled.
 1932webintents/
 1933
19311934# Pointer Lock is not implemented.
19321935pointer-lock/
19331936

LayoutTests/platform/gtk/Skipped

@@fast/frames/flattening/iframe-flattening-fixed-width-and-height-no-scrolling.htm
14351435# https://bugs.webkit.org/show_bug.cgi?id=72248
14361436editing/spelling/spelling-unified-emulation.html
14371437
 1438# Web Intents is not yet enabled.
 1439webintents/
 1440
14381441# Pointer Lock is not implemented.
14391442pointer-lock/
14401443

LayoutTests/platform/mac/Skipped

@@fast/repaint/table-extra-bottom-grow.html
488488# DRT doesn't support overridePreference("WebKit*FontMap"...)
489489fast/text/international/locale-sensitive-fonts.html
490490
 491# Web Intents is not yet enabled.
 492webintents/
 493
491494# Pointer Lock is not implemented.
492495pointer-lock/
493496

LayoutTests/platform/qt/Skipped

@@css3/flexbox/line-wrapping.html
24842484# https://bugs.webkit.org/show_bug.cgi?id=72491
24852485http/tests/misc/onload-remove-iframe-crash-2.html
24862486
 2487# Web Intents is not yet enabled.
 2488webintents/
 2489
24872490# Pointer Lock is not implemented.
24882491pointer-lock/
24892492

LayoutTests/platform/win/Skipped

@@fast/events/platform-wheelevent-paging-y-in-scrolling-page.html
14831483# DRT doesn't support overridePreference("WebKit*FontMap"...)
14841484fast/text/international/locale-sensitive-fonts.html
14851485
 1486# Web Intents is not yet enabled.
 1487webintents/
 1488
14861489# Pointer Lock is not implemented.
14871490pointer-lock/
14881491

LayoutTests/platform/wincairo/Skipped

@@fast/events/platform-wheelevent-paging-y-in-scrolling-page.html
20212021# DRT doesn't support overridePreference("WebKit*FontMap"...)
20222022fast/text/international/locale-sensitive-fonts.html
20232023
 2024# Web Intents is not yet enabled.
 2025webintents/
 2026
20242027# Pointer Lock is not implemented.
20252028pointer-lock/
20262029

LayoutTests/webintents/web-intents-api-expected.txt

 1PASS intent.action is ""
 2PASS new Intent('a') threw exception TypeError: Intent constructor must have zero or two or three parameters.
 3PASS new Intent('a','b','c','d') threw exception TypeError: Intent constructor must have zero or two or three parameters.
 4PASS new Intent('','','') threw exception TypeError: Action cannot be empty.
 5PASS new Intent('','b','c') threw exception TypeError: Action cannot be empty.
 6PASS new Intent('','','c') threw exception TypeError: Action cannot be empty.
 7PASS new Intent('a','','c') threw exception TypeError: Type cannot be empty.
 8PASS intent1.action is "a"
 9PASS intent1.type is "b"
 10PASS intent1.data is null
 11PASS intent1.action is "a"
 12PASS intent2.action is "a"
 13PASS intent2.type is "b"
 14PASS intent2.data is "c"
 15PASS intent3.action is "a"
 16PASS intent3.type is "b"
 17PASS intent3.data.c is "d"
 18PASS intent4.action is "a"
 19PASS intent4.type is "b"
 20PASS intent4.data instanceof Array is true
 21PASS intent4.data.length is 2
 22PASS intent4.data[0] is "c"
 23PASS intent4.data[1] is "d"
 24PASS intent5.data is 4
 25PASS intent6.data is 4.5
 26PASS intent7.data is true
 27PASS intent8.data is null
 28PASS intent9.data == '[object Object]' is true
 29PASS successfullyParsed is true
 30
 31TEST COMPLETE
 32

LayoutTests/webintents/web-intents-api.html

 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 2<html>
 3<head>
 4<script src="../fast/js/resources/js-test-pre.js"></script>
 5</head>
 6<body>
 7<script type="text/javascript">
 8 // TODO(gbillock): eliminate this zero-arg case.
 9 var intent = new Intent();
 10 shouldBeEqualToString('intent.action', '');
 11
 12 shouldThrow("new Intent('a')", "'TypeError: Intent constructor must have zero or two or three parameters'");
 13 shouldThrow("new Intent('a','b','c','d')", "'TypeError: Intent constructor must have zero or two or three parameters'");
 14 shouldThrow("new Intent('','','')", "'TypeError: Action cannot be empty'");
 15 shouldThrow("new Intent('','b','c')", "'TypeError: Action cannot be empty'");
 16 shouldThrow("new Intent('','','c')", "'TypeError: Action cannot be empty'");
 17 shouldThrow("new Intent('a','','c')", "'TypeError: Type cannot be empty'");
 18
 19 var intent1 = new Intent('a', 'b');
 20 shouldBeEqualToString("intent1.action", "a");
 21 shouldBeEqualToString("intent1.type", "b");
 22 shouldBeNull("intent1.data");
 23 intent1.action = "abc";
 24 shouldBeEqualToString("intent1.action", "a");
 25
 26 var intent2 = new Intent("a", "b", "c");
 27 shouldBeEqualToString('intent2.action', "a");
 28 shouldBeEqualToString('intent2.type', "b");
 29 shouldBeEqualToString('intent2.data', "c");
 30
 31 var intent3 = new Intent("a", "b", {"c": "d"});
 32 shouldBeEqualToString('intent3.action', "a");
 33 shouldBeEqualToString('intent3.type', "b");
 34 shouldBeEqualToString('intent3.data.c', "d");
 35
 36 var intent4 = new Intent("a", "b", ["c", "d"]);
 37 shouldBeEqualToString('intent4.action', "a");
 38 shouldBeEqualToString('intent4.type', "b");
 39 shouldBeTrue('intent4.data instanceof Array');
 40 shouldEvaluateTo('intent4.data.length', 2);
 41 shouldBeEqualToString('intent4.data[0]', "c");
 42 shouldBeEqualToString('intent4.data[1]', "d");
 43
 44 var intent5 = new Intent("a", "b", 4);
 45 shouldEvaluateTo('intent5.data', 4);
 46 var intent6 = new Intent('a', 'b', 4.5);
 47 shouldEvaluateTo('intent6.data', 4.5);
 48 var intent7 = new Intent('a', 'b', true);
 49 shouldBeTrue('intent7.data');
 50 var intent8 = new Intent('a', 'b', null);
 51 shouldBeNull('intent8.data');
 52 var intent9 = new Intent('a', 'b', {});
 53 shouldEvaluateTo('intent9.data', {});
 54</script>
 55<script src="../fast/js/resources/js-test-post.js"></script>
 56</body>
 57</html>