Source/WebCore/ChangeLog

 12012-01-06 Greg Billock <gbillock@google.com>
 2
 3 Implement navigator.startActivity; add IntentsController for managing web intents callbacks.
 4 https://bugs.webkit.org/show_bug.cgi?id=75756
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Test: webintents/web-intents-api.html
 9
 10 * Modules/intents/Intent.cpp: Added.
 11 (WebCore::Intent::create):
 12 (WebCore::Intent::Intent):
 13 (WebCore::Intent::action):
 14 (WebCore::Intent::type):
 15 (WebCore::Intent::data):
 16 (WebCore::Intent::setData):
 17 (WebCore::Intent::identifier):
 18 (WebCore::Intent::setIdentifier):
 19 * Modules/intents/Intent.h: Added.
 20 * Modules/intents/Intent.idl: Added.
 21 * Modules/intents/IntentResultCallback.h: Added.
 22 (WebCore::IntentResultCallback::~IntentResultCallback):
 23 * Modules/intents/IntentResultCallback.idl: Added.
 24 * Modules/intents/IntentsController.cpp: Added.
 25 (WebCore::IntentsController::IntentsController):
 26 (WebCore::IntentsController::~IntentsController):
 27 (WebCore::IntentsController::create):
 28 (WebCore::intentId):
 29 (WebCore::IntentsController::assignIntentId):
 30 (WebCore::IntentsController::postResult):
 31 (WebCore::IntentsController::postFailure):
 32 * Modules/intents/IntentsController.h: Added.
 33 * WebCore.gyp/WebCore.gyp:
 34 * WebCore.gypi:
 35 * bindings/scripts/CodeGeneratorV8.pm:
 36 (GetNativeTypeForCallbacks):
 37 * dom/ScriptExecutionContext.cpp:
 38 (WebCore::ScriptExecutionContext::ScriptExecutionContext):
 39 * dom/ScriptExecutionContext.h:
 40 (WebCore::ScriptExecutionContext::intentsController):
 41 * loader/FrameLoaderClient.h:
 42 (WebCore::FrameLoaderClient::dispatchIntent):
 43 * page/DOMWindow.idl:
 44 * page/Navigator.cpp:
 45 (WebCore::Navigator::startActivity):
 46 * page/Navigator.h:
 47 * page/Navigator.idl:
 48
1492012-01-05 Antti Koivisto <antti@apple.com>
250
351 REGRESSION (r104060): fast/forms/textarea-metrics.html is failing

Source/WebKit/chromium/ChangeLog

 12012-01-06 Greg Billock <gbillock@google.com>
 2
 3 Implement navigator.startActivity; add IntentsController for managing web intents callbacks.
 4 https://bugs.webkit.org/show_bug.cgi?id=75756
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * features.gypi:
 9
1102012-01-05 Jochen Eisinger <jochen@chromium.org>
211
312 Check whether a WebView exists before accessing it in StorageAreaProxy. This is not necessarily the case, e.g. for detached iframes.

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 ConstructorParameters=3,
 30 Constructor(in DOMString action, in DOMString type, in [Optional=CallWithNullValue] SerializedScriptValue data),
 31 ConstructorRaisesException
 32 ] Intent {
 33 readonly attribute [InitializedByConstructor] DOMString action;
 34 readonly attribute [InitializedByConstructor] DOMString type;
 35 readonly attribute [InitializedByConstructor] SerializedScriptValue data;
 36 };
 37}

Source/WebCore/Modules/intents/IntentResultCallback.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 IntentResultCallback_h
 30#define IntentResultCallback_h
 31
 32#include <wtf/RefCounted.h>
 33#include <wtf/RefPtr.h>
 34
 35#if ENABLE(WEB_INTENTS)
 36
 37namespace WebCore {
 38
 39class SerializedScriptValue;
 40
 41class IntentResultCallback : public RefCounted<IntentResultCallback> {
 42public:
 43 virtual ~IntentResultCallback() { }
 44 virtual bool handleEvent(SerializedScriptValue* result) = 0;
 45};
 46
 47}
 48
 49#endif
 50
 51#endif // IntentResultCallback_h

Source/WebCore/Modules/intents/IntentResultCallback.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 Callback=FunctionOnly
 30 ] IntentResultCallback {
 31 boolean handleEvent(in SerializedScriptValue result);
 32 };
 33}

Source/WebCore/Modules/intents/IntentsController.cpp

 1/*
 2 * Copyright (C) 2010 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
 26#include "config.h"
 27#include "IntentsController.h"
 28
 29#if ENABLE(WEB_INTENTS)
 30
 31#include "IntentResultCallback.h"
 32#include "SerializedScriptValue.h"
 33
 34namespace WebCore {
 35
 36IntentsController::IntentsController()
 37{
 38}
 39
 40IntentsController::~IntentsController()
 41{
 42}
 43
 44PassOwnPtr<IntentsController> IntentsController::create()
 45{
 46 return adoptPtr(new IntentsController);
 47}
 48
 49static int intentId()
 50{
 51 ASSERT(isMainThread());
 52 static int lastUsedIntentId = 0;
 53 ++lastUsedIntentId;
 54 return lastUsedIntentId;
 55}
 56
 57int IntentsController::assignIntentId(PassRefPtr<IntentResultCallback> successCallback, PassRefPtr<IntentResultCallback> errorCallback)
 58{
 59 int id = intentId();
 60 m_successCallbacks.set(id, successCallback);
 61 m_errorCallbacks.set(id, errorCallback);
 62 return id;
 63}
 64
 65void IntentsController::postResult(const String& data, int intentId)
 66{
 67 RefPtr<SerializedScriptValue> value = SerializedScriptValue::createFromWire(data);
 68 RefPtr<IntentResultCallback> successCallback = m_successCallbacks.take(intentId);
 69 m_errorCallbacks.remove(intentId);
 70
 71 if (successCallback.get())
 72 successCallback->handleEvent(value.get());
 73}
 74
 75void IntentsController::postFailure(const String& data, int intentId)
 76{
 77 RefPtr<SerializedScriptValue> value = SerializedScriptValue::createFromWire(data);
 78 RefPtr<IntentResultCallback> errorCallback = m_errorCallbacks.take(intentId);
 79 m_successCallbacks.remove(intentId);
 80
 81 if (errorCallback.get())
 82 errorCallback->handleEvent(value.get());
 83}
 84
 85} // namespace WebCore
 86
 87#endif // ENABLE(WEB_INTENTS)

Source/WebCore/Modules/intents/IntentsController.h

 1/*
 2 * Copyright (C) 2010 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
 26#ifndef IntentsController_h
 27#define IntentsController_h
 28
 29#if ENABLE(WEB_INTENTS)
 30
 31#include <wtf/Forward.h>
 32#include <wtf/HashMap.h>
 33#include <wtf/PassOwnPtr.h>
 34#include <wtf/PassRefPtr.h>
 35
 36namespace WebCore {
 37
 38class IntentResultCallback;
 39
 40class IntentsController {
 41 WTF_MAKE_NONCOPYABLE(IntentsController);
 42public:
 43 ~IntentsController();
 44
 45 static PassOwnPtr<IntentsController> create();
 46
 47 int assignIntentId(PassRefPtr<IntentResultCallback> successCallback, PassRefPtr<IntentResultCallback> errorCallback);
 48
 49 void postResult(const String& data, int intentId);
 50 void postFailure(const String& data, int intentId);
 51
 52private:
 53 IntentsController();
 54
 55 typedef HashMap<int, RefPtr<IntentResultCallback> > CallbackMap;
 56 CallbackMap m_successCallbacks;
 57 CallbackMap m_errorCallbacks;
 58};
 59
 60} // namespace WebCore
 61
 62#endif // ENABLE(WEB_INTENTS)
 63
 64#endif // IntentsController_h

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

11491149 'Modules/gamepad/Gamepad.idl',
11501150 'Modules/gamepad/GamepadList.idl',
11511151 'Modules/gamepad/NavigatorGamepad.idl',
 1152 'Modules/intents/Intent.idl',
 1153 'Modules/intents/IntentResultCallback.idl',
11521154 'css/CSSCharsetRule.idl',
11531155 'css/CSSFontFaceRule.idl',
11541156 'css/CSSImportRule.idl',

16951697 'Modules/gamepad/GamepadList.h',
16961698 'Modules/gamepad/NavigatorGamepad.cpp',
16971699 'Modules/gamepad/NavigatorGamepad.h',
 1700 'Modules/intents/Intent.cpp',
 1701 'Modules/intents/Intent.h',
 1702 'Modules/intents/IntentResultCallback.h',
 1703 'Modules/intents/IntentsController.cpp',
 1704 'Modules/intents/IntentsController.h',
16981705 'accessibility/AXObjectCache.cpp',
16991706 'accessibility/AccessibilityARIAGrid.cpp',
17001707 'accessibility/AccessibilityARIAGrid.h',

Source/WebCore/bindings/scripts/CodeGeneratorV8.pm

@@sub GetNativeTypeForCallbacks
34293429{
34303430 my $type = shift;
34313431 return "const String&" if $type eq "DOMString";
 3432 return "SerializedScriptValue*" if $type eq "SerializedScriptValue";
34323433
34333434 # Callbacks use raw pointers, so pass isParameter = 1
34343435 return GetNativeType($type, 1);

Source/WebCore/dom/ScriptExecutionContext.cpp

3737#include "EventListener.h"
3838#include "EventTarget.h"
3939#include "FileThread.h"
 40#include "IntentsController.h"
4041#include "MessagePort.h"
4142#include "ScriptCallStack.h"
4243#include "SecurityOrigin.h"

@@ScriptExecutionContext::ScriptExecutionContext()
9697#if ENABLE(SQL_DATABASE)
9798 , m_hasOpenDatabases(false)
9899#endif
 100#if ENABLE(WEB_INTENTS)
 101 , m_intentsController(IntentsController::create())
 102#endif
99103{
100104}
101105

Source/WebCore/dom/ScriptExecutionContext.h

@@class DatabaseThread;
6363class FileThread;
6464#endif
6565
 66#if ENABLE(WEB_INTENTS)
 67class IntentsController;
 68#endif
 69
6670class ScriptExecutionContext : public SecurityContext {
6771public:
6872 ScriptExecutionContext();

@@public:
157161
158162 virtual EventQueue* eventQueue() const = 0;
159163
 164#if ENABLE(WEB_INTENTS)
 165 IntentsController* intentsController() const { return m_intentsController.get(); }
 166#endif
 167
160168protected:
161169 class AddConsoleMessageTask : public Task {
162170 public:

@@private:
213221#if ENABLE(BLOB) || ENABLE(FILE_SYSTEM)
214222 RefPtr<FileThread> m_fileThread;
215223#endif
 224
 225#if ENABLE(WEB_INTENTS)
 226 OwnPtr<IntentsController> m_intentsController;
 227#endif
216228};
217229
218230} // namespace WebCore

Source/WebCore/loader/FrameLoaderClient.h

@@namespace WebCore {
7878#endif
7979 class HTMLPlugInElement;
8080 class IntSize;
 81#if ENABLE(WEB_INTENTS)
 82 class Intent;
 83#endif
8184 class KURL;
8285 class MessageEvent;
8386 class NavigationAction;

@@namespace WebCore {
323326
324327 // Returns true if the embedder intercepted the postMessage call
325328 virtual bool willCheckAndDispatchMessageEvent(SecurityOrigin* /*target*/, MessageEvent*) const { return false; }
 329
 330#if ENABLE(WEB_INTENTS)
 331 virtual void dispatchIntent(const Intent& intent) { }
 332#endif
326333 };
327334
328335} // namespace WebCore

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/WebCore/page/Navigator.cpp

3333#include "FrameLoader.h"
3434#include "FrameLoaderClient.h"
3535#include "Geolocation.h"
 36#include "Intent.h"
 37#include "IntentResultCallback.h"
 38#include "IntentsController.h"
3639#include "PointerLock.h"
3740#include "KURL.h"
3841#include "Language.h"

4043#include "PageGroup.h"
4144#include "PlatformString.h"
4245#include "PluginData.h"
 46#include "ScriptExecutionContext.h"
4347#include "Settings.h"
4448#include "StorageNamespace.h"
4549#include <wtf/HashSet.h>

@@GamepadList* Navigator::gamepads()
319323}
320324#endif
321325
 326#if ENABLE(WEB_INTENTS)
 327void Navigator::startActivity(ScriptExecutionContext* context,
 328 Intent* intent, PassRefPtr<IntentResultCallback> successCallback, PassRefPtr<IntentResultCallback> errorCallback, ExceptionCode& ec)
 329{
 330 Frame* activeFrame = static_cast<Document*>(context)->frame();
 331 if (!activeFrame || !intent) {
 332 ec = INVALID_STATE_ERR;
 333 return;
 334 }
 335
 336 if (intent->action().isEmpty() || intent->type().isEmpty()) {
 337 ec = VALIDATION_ERR;
 338 return;
 339 }
 340
 341 if (!ScriptController::processingUserGesture()) {
 342 ec = INVALID_ACCESS_ERR;
 343 return;
 344 }
 345
 346 int id = context->intentsController()->assignIntentId(successCallback, errorCallback);
 347 intent->setIdentifier(id);
 348 activeFrame->loader()->client()->dispatchIntent(*intent);
 349}
 350#endif
 351
322352} // namespace WebCore

Source/WebCore/page/Navigator.h

@@class DOMPluginArray;
3333class Frame;
3434class GamepadList;
3535class Geolocation;
 36class Intent;
 37class IntentResultCallback;
3638class PointerLock;
3739class NavigatorUserMediaErrorCallback;
3840class NavigatorUserMediaSuccessCallback;
3941class PluginData;
 42class ScriptExecutionContext;
4043
4144typedef int ExceptionCode;
4245

@@public:
8083 GamepadList* gamepads();
8184#endif
8285
 86#if ENABLE(WEB_INTENTS)
 87 void startActivity(ScriptExecutionContext*,
 88 Intent*, PassRefPtr<IntentResultCallback> successCallback, PassRefPtr<IntentResultCallback> errorCallback, ExceptionCode&);
 89#endif
 90
8391private:
8492 Navigator(Frame*);
8593 Frame* m_frame;

Source/WebCore/page/Navigator.idl

@@module window {
6161 in [Callback=FunctionOnly, Optional] NavigatorUserMediaErrorCallback errorCallback)
6262 raises(DOMException);
6363#endif
 64
 65#if defined(ENABLE_WEB_INTENTS) && ENABLE_WEB_INTENTS
 66 [CallWith=ScriptExecutionContext] void startActivity(in Intent intent,
 67 in [Callback=FunctionOnly, Optional] IntentResultCallback successCallback,
 68 in [Callback=FunctionOnly, Optional] IntentResultCallback failureCallback)
 69 raises(DOMException);
 70#endif
6471 };
6572
6673}

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/ChangeLog

 12012-01-06 Greg Billock <gbillock@google.com>
 2
 3 Implement navigator.startActivity; add IntentsController for managing web intents callbacks.
 4 https://bugs.webkit.org/show_bug.cgi?id=75756
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * platform/efl/Skipped:
 9 * platform/gtk/Skipped:
 10 * platform/mac/Skipped:
 11 * platform/qt/Skipped:
 12 * platform/win/Skipped:
 13 * platform/wincairo/Skipped:
 14 * webintents/web-intents-api-expected.txt: Added.
 15 * webintents/web-intents-api.html: Added.
 16
1172012-01-06 Elliot Poger <epoger@google.com>
218
319 make canvas-lineWidth test pass even if pixel values vary a tiny bit

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 navigator.startActivity is defined.
 2PASS var intent = new Intent() threw exception TypeError: Not enough arguments.
 3PASS new Intent('a') threw exception TypeError: Not enough arguments.
 4PASS new Intent('','','') threw exception Error: SYNTAX_ERR: DOM Exception 12.
 5PASS new Intent('','b','c') threw exception Error: SYNTAX_ERR: DOM Exception 12.
 6PASS new Intent('','','c') threw exception Error: SYNTAX_ERR: DOM Exception 12.
 7PASS new Intent('a','','c') threw exception Error: SYNTAX_ERR: DOM Exception 12.
 8PASS intent1.action is "a"
 9PASS intent1.type is "b"
 10PASS intent1.data is undefined.
 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 navigator.startActivity(intent1) threw exception Error: INVALID_ACCESS_ERR: DOM Exception 15.
 30PASS successfullyParsed is true
 31
 32TEST COMPLETE
 33

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 shouldBeDefined("navigator.startActivity");
 9
 10 shouldThrow("var intent = new Intent()", "'TypeError: Not enough arguments'");;
 11 shouldThrow("new Intent('a')", "'TypeError: Not enough arguments'");
 12 shouldThrow("new Intent('','','')", "'Error: SYNTAX_ERR: DOM Exception 12'");
 13 shouldThrow("new Intent('','b','c')", "'Error: SYNTAX_ERR: DOM Exception 12'");
 14 shouldThrow("new Intent('','','c')", "'Error: SYNTAX_ERR: DOM Exception 12'");
 15 shouldThrow("new Intent('a','','c')", "'Error: SYNTAX_ERR: DOM Exception 12'");
 16
 17 var intent1 = new Intent('a', 'b');
 18 shouldBeEqualToString("intent1.action", "a");
 19 shouldBeEqualToString("intent1.type", "b");
 20 shouldBeUndefined("intent1.data");
 21 intent1.action = "abc";
 22 shouldBeEqualToString("intent1.action", "a");
 23
 24 var intent2 = new Intent("a", "b", "c");
 25 shouldBeEqualToString('intent2.action', "a");
 26 shouldBeEqualToString('intent2.type', "b");
 27 shouldBeEqualToString('intent2.data', "c");
 28
 29 var intent3 = new Intent("a", "b", {"c": "d"});
 30 shouldBeEqualToString('intent3.action', "a");
 31 shouldBeEqualToString('intent3.type', "b");
 32 shouldBeEqualToString('intent3.data.c', "d");
 33
 34 var intent4 = new Intent("a", "b", ["c", "d"]);
 35 shouldBeEqualToString('intent4.action', "a");
 36 shouldBeEqualToString('intent4.type', "b");
 37 shouldBeTrue('intent4.data instanceof Array');
 38 shouldEvaluateTo('intent4.data.length', 2);
 39 shouldBeEqualToString('intent4.data[0]', "c");
 40 shouldBeEqualToString('intent4.data[1]', "d");
 41
 42 var intent5 = new Intent("a", "b", 4);
 43 shouldEvaluateTo('intent5.data', 4);
 44 var intent6 = new Intent('a', 'b', 4.5);
 45 shouldEvaluateTo('intent6.data', 4.5);
 46 var intent7 = new Intent('a', 'b', true);
 47 shouldBeTrue('intent7.data');
 48 var intent8 = new Intent('a', 'b', null);
 49 shouldBeNull('intent8.data');
 50 var intent9 = new Intent('a', 'b', {});
 51 shouldEvaluateTo('intent9.data', {});
 52
 53 shouldThrow('navigator.startActivity(intent1)', "'Error: INVALID_ACCESS_ERR: DOM Exception 15'");
 54</script>
 55<script src="../fast/js/resources/js-test-post.js"></script>
 56</body>
 57</html>