Bug 52718

Summary: Send origin/url as part of speech input requests to the embedder.
Product: WebKit Reporter: Satish Sampath <satish>
Component: FormsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: fishd, jorlow, levin
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 39485    
Attachments:
Description Flags
Patch
none
Patch jorlow: review+

Description Satish Sampath 2011-01-19 06:29:15 PST
In the embedder we need the page/frame url which requests speech input. One example is for deciding when/whether to ask for user consent before starting speech input.
Comment 1 Satish Sampath 2011-01-19 06:40:59 PST
Created attachment 79415 [details]
Patch
Comment 2 Jeremy Orlow 2011-01-19 07:00:30 PST
Comment on attachment 79415 [details]
Patch

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

> Source/WebCore/page/SpeechInput.cpp:96
> +bool SpeechInput::startRecognition(int listenerId, const IntRect& elementRect, const AtomicString& language, const String& grammar, PassRefPtr<SecurityOrigin> origin)

Just pass a pointer.

> Source/WebCore/page/SpeechInput.h:65
> +    bool startRecognition(int listenerId, const IntRect& elementRect, const AtomicString& language, const String& grammar, PassRefPtr<SecurityOrigin>);

ditto

> Source/WebCore/page/SpeechInputClient.h:54
> +    virtual bool startRecognition(int requestId, const IntRect& elementRect, const AtomicString& language, const String& grammar, PassRefPtr<SecurityOrigin>) = 0;

ditto

> Source/WebCore/platform/mock/SpeechInputClientMock.cpp:54
> +bool SpeechInputClientMock::startRecognition(int requestId, const IntRect& elementRect, const AtomicString& language, const String& grammar, PassRefPtr<SecurityOrigin> origin)

ditto

> Source/WebCore/platform/mock/SpeechInputClientMock.h:57
> +    bool startRecognition(int requestId, const IntRect& elementRect, const AtomicString& language, const String& grammar, PassRefPtr<SecurityOrigin>);

ditto

> Source/WebCore/rendering/TextControlInnerElements.cpp:440
> +              RefPtr<SecurityOrigin> origin(SecurityOrigin::create(document()->url()));

You should be able to get this some other way.

> Source/WebCore/rendering/TextControlInnerElements.cpp:441
> +              if (speechInput()->startRecognition(m_listenerId, rect, language, grammar, origin))

origin.get()

> Source/WebKit/chromium/src/SpeechInputClientImpl.cpp:67
> +bool SpeechInputClientImpl::startRecognition(int requestId, const WebCore::IntRect& elementRect, const AtomicString& language, const String& grammar, PassRefPtr<WebCore::SecurityOrigin> origin)

*

> Source/WebKit/chromium/src/SpeechInputClientImpl.h:61
> +    bool startRecognition(int requestId, const WebCore::IntRect& elementRect, const AtomicString& language, const String& grammar, PassRefPtr<WebCore::SecurityOrigin>);

*
Comment 3 Satish Sampath 2011-01-19 07:58:50 PST
Created attachment 79428 [details]
Patch
Comment 4 Satish Sampath 2011-01-19 08:01:57 PST
(In reply to comment #2)
I converted all PassRefPtrs to raw pointers as suggested and now using document()->securityOrigin() to get the existing SecurityOrigin object from Document/ScriptExecutionContext. I have also updated existing code in WebGeolocationPermissionRequest.cpp which was doing a similar thing as I did earlier.
Comment 5 Jeremy Orlow 2011-01-19 08:09:28 PST
Comment on attachment 79428 [details]
Patch

r=me

can you please fix the creation of a security origin in geolocation as well?
Comment 6 Satish Sampath 2011-01-19 08:21:28 PST
(In reply to comment #5)
> (From update of attachment 79428 [details])
> r=me
> 
> can you please fix the creation of a security origin in geolocation as well?

Yes, I have in this same patch.
Comment 7 Jeremy Orlow 2011-01-19 08:22:30 PST
Oops...yes you do.
Comment 8 Satish Sampath 2011-01-19 08:42:04 PST
Committed r76128: <http://trac.webkit.org/changeset/76128>
Comment 9 David Levin 2011-01-19 09:11:08 PST
Please cc Darin for WebKit API changes.
Comment 10 Jeremy Orlow 2011-01-19 09:22:47 PST
Darin, do you actually want CLs like this?  The API side of it seemed quite straightforward and there's plenty of similar precedent.