RESOLVED FIXED 128839
Add WKBackForwardListDidChangeNotification
https://bugs.webkit.org/show_bug.cgi?id=128839
Summary Add WKBackForwardListDidChangeNotification
Anders Carlsson
Reported 2014-02-14 13:19:20 PST
Add WKBackForwardListDidChangeNotification
Attachments
Patch (13.65 KB, patch)
2014-02-14 13:20 PST, Anders Carlsson
mitz: review+
Anders Carlsson
Comment 1 2014-02-14 13:20:32 PST
mitz
Comment 2 2014-02-14 13:29:15 PST
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.
Anders Carlsson
Comment 3 2014-02-14 14:04:48 PST
Note You need to log in before you can comment on or make changes to this bug.