Commit fa5125e7 authored by Guillaume Jenkins's avatar Guillaume Jenkins Committed by Commit Bot

[Siri Shortcuts] Correctly check for searchPhrase existence

The previous way of checking whether the searchPhrase property existed
on the SearchInChrome intent object was respondsToSelector:, which
didn't work.

This fix uses valueForKey: instead, which appears to be a safe way to
check whether searchPhrase exists on the intent object.

Bug: 1133825
Change-Id: I82242e2398359f1955fd93b06ecdc4648fcaf5df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2459566
Commit-Queue: Guillaume Jenkins <gujen@google.com>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815703}
parent c1b7eba6
......@@ -170,10 +170,15 @@ std::vector<GURL> createGURLVectorFromIntentURLs(NSArray<NSURL*>* intentURLs) {
base::mac::ObjCCastStrict<SearchInChromeIntent>(
userActivity.interaction.intent);
if (intent &&
[intent respondsToSelector:NSSelectorFromString(@"searchPhrase")] &&
intent.searchPhrase && [intent.searchPhrase length]) {
startupParams.textQuery = intent.searchPhrase;
if (!intent) {
return NO;
}
id searchPhrase = [intent valueForKey:@"searchPhrase"];
if ([searchPhrase isKindOfClass:[NSString class]] &&
[searchPhrase length]) {
startupParams.textQuery = searchPhrase;
} else {
startupParams.postOpeningAction = FOCUS_OMNIBOX;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment