Summary: | Add WKBackForwardListDidChangeNotification | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Anders Carlsson <andersca> | ||||
Component: | New Bugs | Assignee: | Anders Carlsson <andersca> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | mitz | ||||
Priority: | P2 | ||||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Attachments: |
|
Description
Anders Carlsson
2014-02-14 13:19:20 PST
Created attachment 224248 [details]
Patch
Comment on attachment 224248 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=224248&action=review > Source/WebKit2/UIProcess/API/Cocoa/WKBackForwardList.mm:36 > +WK_EXPORT NSString * const WKBackForwardListDidChangeNotification = @"WKBackForwardListDidChangeNotification"; > +WK_EXPORT NSString * const WKBackForwardListAddedItemKey = @"WKBackForwardListAddedItemKey"; > +WK_EXPORT NSString * const WKBackForwardListRemovedItemsKey = @"WKBackForwardListRemovedItemsKey"; There’s no need to use WK_EXPORT here. > Source/WebKit2/UIProcess/Cocoa/NavigationState.mm:398 > + if (addedItem) { > + keys.append(WKBackForwardListAddedItemKey); > + values.append(wrapper(*addedItem)); > + } > + > + if (!removedItems.isEmpty()) { > + Vector<id> removed; > + removed.reserveInitialCapacity(removedItems.size()); > + > + for (const auto& removedItem : removedItems) > + removed.uncheckedAppend(wrapper(*removedItem)); > + > + keys.append(WKBackForwardListRemovedItemsKey); > + values.append([NSArray arrayWithObjects:removed.data() count:removed.size()]); > + } > + > + auto userInfo = adoptNS([[NSDictionary alloc] initWithObjects:values.data() forKeys:keys.data() count:keys.size()]); Why take the risk that someone might append to one vector and not the other? Just create an NSMutableDictionary and use setObject:forKey: or the equivalent subscript syntax. Committed r164132: <http://trac.webkit.org/changeset/164132> |