From 042a525862c8692b58e454396957bd4d0df56eb9 Mon Sep 17 00:00:00 2001 From: NN Date: Sun, 18 Jan 2015 21:54:45 +0200 Subject: [PATCH 1/2] Add optional filters to webNavigation events There is an additional argument according to https://developer.chrome.com/extensions/webNavigation Filters argument is not well documented but present. Sample from Google: https://developer.chrome.com/extensions/examples/extensions/gmail/background.js --- chrome/chrome.d.ts | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index ede0dfa40..e0948f3b1 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -140,7 +140,7 @@ declare module chrome.browserAction { interface TitleDetails { title: string; - tabId?: number; + tabId?: number;WebNavigationReferenceFragmentUpdatedEvent } interface TabDetails { @@ -2173,20 +2173,24 @@ declare module chrome.webNavigation { error: string; } + interface WebNavigationEventFilters { + url: chrome.events.UrlFilter[]; + } + interface WebNavigationReferenceFragmentUpdatedEvent extends chrome.events.Event { - addListener(callback: (details: ReferenceFragmentUpdatedDetails) => void): void; + addListener(callback: (details: ReferenceFragmentUpdatedDetails) => void, filters? : WebNavigationEventFilters): void; } interface WebNavigationCompletedEvent extends chrome.events.Event { - addListener(callback: (details: CompletedDetails) => void): void; + addListener(callback: (details: CompletedDetails) => void, filters? : WebNavigationEventFilters): void; } interface WebNavigationHistoryStateUpdatedEvent extends chrome.events.Event { - addListener(callback: (details: HistoryStateUpdatedDetails) => void): void; + addListener(callback: (details: HistoryStateUpdatedDetails) => void, filters?: WebNavigationEventFilters): void; } interface WebNavigationCreatedNavigationTargetEvent extends chrome.events.Event { - addListener(callback: (details: CreatedNavigationTargetDetails) => void): void; + addListener(callback: (details: CreatedNavigationTargetDetails) => void, filters?: WebNavigationEventFilters): void; } interface WebNavigationTabReplacedEvent extends chrome.events.Event { @@ -2194,19 +2198,19 @@ declare module chrome.webNavigation { } interface WebNavigationBeforeNavigateEvent extends chrome.events.Event { - addListener(callback: (details: BeforeNavigateDetails) => void): void; + addListener(callback: (details: BeforeNavigateDetails) => void, filters?: WebNavigationEventFilters): void; } interface WebNavigationCommittedEvent extends chrome.events.Event { - addListener(callback: (details: CommittedDetails) => void): void; + addListener(callback: (details: CommittedDetails) => void, filters?: WebNavigationEventFilters): void; } interface WebNavigationDomContentLoadedEvent extends chrome.events.Event { - addListener(callback: (details: DomContentLoadedDetails) => void): void; + addListener(callback: (details: DomContentLoadedDetails) => void, filters?: WebNavigationEventFilters): void; } interface WebNavigationErrorOccurredEvent extends chrome.events.Event { - addListener(callback: (details: ErrorOccurredDetails) => void): void; + addListener(callback: (details: ErrorOccurredDetails) => void, filters?: WebNavigationEventFilters): void; } export function getFrame(details: GetFrameDetails, callback: (details?: GetFrameResultDetails) => void): void; From 5a07b46cf4b0406eb6f1cf06a81abee41e804d9e Mon Sep 17 00:00:00 2001 From: NN Date: Mon, 19 Jan 2015 12:39:04 +0200 Subject: [PATCH 2/2] Fix typo --- chrome/chrome.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index e0948f3b1..782b6c78f 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -140,7 +140,7 @@ declare module chrome.browserAction { interface TitleDetails { title: string; - tabId?: number;WebNavigationReferenceFragmentUpdatedEvent + tabId?: number; } interface TabDetails {