-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Web Extensions: Parse getRecent() bookmark function #47086
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Web Extensions: Parse getRecent() bookmark function #47086
Conversation
EWS run on previous version of this PR (hash 878f98b) |
Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIBookmarks.h
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIBookmarks.h
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requesting changes based on previous comments
@@ -35,9 +35,50 @@ | |||
|
|||
namespace WebKit { | |||
|
|||
NSDictionary* WebExtensionAPIBookmarks::createDictionaryFromNode(const MockBookmarkNode& node) | |||
{ | |||
double msSinceEpoch = (node.dateAdded + kCFAbsoluteTimeIntervalSince1970) * 1000.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use toImpl()
from CocoaHelpers.h
.
WallTime toImpl(NSDate *);
Then toImpl(node.dateAdded).secondsSinceEpoch().milliseconds()
.
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
std::string id; | ||
std::string title; | ||
std::string url; | ||
CFAbsoluteTime dateAdded; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer WTF::WallTime
.
Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIBookmarks.h
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIBookmarks.h
Outdated
Show resolved
Hide resolved
878f98b
to
5e559ac
Compare
EWS run on previous version of this PR (hash 5e559ac) |
5e559ac
to
256aa88
Compare
EWS run on previous version of this PR (hash 256aa88) |
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIBookmarks.h
Outdated
Show resolved
Hide resolved
Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIBookmarks.mm
Outdated
Show resolved
Hide resolved
256aa88
to
9a37c49
Compare
EWS run on previous version of this PR (hash 9a37c49) |
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
9a37c49
to
f4e8617
Compare
EWS run on previous version of this PR (hash f4e8617) |
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm
Outdated
Show resolved
Hide resolved
NSArray *requiredKeys = @[ @"id", @"url", @"dateAdded" ]; | ||
NSDictionary *types = @{ | ||
WebExtensionBookmarkIDKey: [NSString class], | ||
WebExtensionBookmarkURLKey: [NSString class], | ||
WebExtensionBookmarkDateAddedKey: [NSNumber class], | ||
WebExtensionBookmarkTitleKey: [NSString class] | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use constants defined above here. NSString.class
, NSNumber.class
.
MockBookmarkNode newNode; | ||
newNode.id = bookmark[@"id"]; | ||
newNode.url = bookmark[@"url"]; | ||
id dateAddedValue = bookmark[@"dateAdded"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for a local. Should use auto *
instead of id
.
f4e8617
to
66e36a3
Compare
EWS run on current version of this PR (hash 66e36a3) |
rdar://153924872 https://bugs.webkit.org/show_bug.cgi?id=294766 Reviewed by Timothy Hatcher. Added Parsing for getRecent that uses mock BookmarkTreeNodes created by Create() to test its functionality. Added tests for this as well. * Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIBookmarksCocoa.mm: (WebKit::WebExtensionAPIBookmarks::createDictionaryFromNode): (WebKit::WebExtensionAPIBookmarks::createBookmark): (WebKit::WebExtensionAPIBookmarks::getRecent): * Source/WebKit/WebProcess/Extensions/API/WebExtensionAPIBookmarks.h: * Source/WebKit/WebProcess/Extensions/Interfaces/WebExtensionAPIBookmarks.idl: * Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIBookmarks.mm: (TestWebKitAPI::TEST_F(WKWebExtensionAPIBookmarks, BookmarksAPICheckgetRecent)): (TestWebKitAPI::TEST_F(WKWebExtensionAPIBookmarks, BookmarksAPIMockNodeWithgetRecent)): Canonical link: https://commits.webkit.org/296640@main
66e36a3
to
6663438
Compare
Committed 296640@main (6663438): https://commits.webkit.org/296640@main Reviewed commits have been landed. Closing PR #47086 and removing active labels. |
6663438
66e36a3
🛠 win🧪 wpe-wk2🧪 win-tests🧪 ios-wk2🧪 ios-wk2-wpt🛠 wpe-cairo🧪 mac-AS-debug-wk2🧪 gtk-wk2🛠 playstation🛠 mac-safer-cpp