-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Complete migration to CDP (#539)
* Shift service worker to use CDP completely. * Fix JS cookies for CDP. * Fix JS cookies. Fix TS-lint warnings. * Remove optional chaining for frame id * Fix condition for frame filtering. Fix the url parser. * Fix frameId association. * Fix deletion of data at correct event. * Get all cookies for current tab via CDP. * Add multitab support. * Add tab data when extension is updated. * Make multitab work * Fix multi-tab analysis methodology for CDP. * Keep previous frame. * Fix the inconsistency in frame and cookie association. * Fix removal of frameIdUrlSet. * Add some conditions. Add cookies by parsing network urls. Just like application tab does. * Use loaderid to load other cookies. * Fix frame mapping of cookies. * Test fix. * revert test fix * Destructure code to make it pretty. * Enable CDP by default * Refactor code to make it pretty. * Fix failing tests. * Revert some changes * Revert using loader id. * More precise mapping of data. * Collect resource urls. * collect frame resource urls. * Send cookies from resources. * Reinsert adding extra frame urls from service worker. Remove unnecessary code from the synchnorous cookie store. * Add comments explaining each thing in the chrome.debugger. * Fix some redundant issues remove auditsIssuesStore. * Fix errors thrown on extension page. * Add proper frameIds to map the cookies to frames better. * - Remove parentChildFrameAssociation from service worker. - Move the frameId and parent Association to the synchnourousCookieStore. - Call from cookie provider to get additional data from service worker when devtools is opened. * Fix some variable additions. * Move all listeners to separate files. * Split serviceworker into more listeners. * Fix bug. * Fix failing tests. * Reintroduce webRequest API. * Fix cli tsc problems. * create separate functions for listeners. * Bug fix frame id association. * Fix frame management after extension update. * Add service worker test. Rename chrome listeners to listeners. Refactor CDP migration api to use new methodology of supplementation. * Revert jest config. * Revert parsing method. * Remove use of mainFrameId. * Rearrange functions in sync cookie store. * Refactor code. * update frameId logic * Revert logic of frame addition. * Refactor code and fix js cookie. * Move cookieDB to synchnorous cookie store. * Fix arguments in getAndParseNetworkCookies * Fix failing tests. * Make non cdp environement work. Convert non-cdp frameIds to string to accomodate non-cdp cookie analysis. * Fix failing tests. * Detach debugger from targets when cdp is switched off * Revert setting cdp as default true. * Remove exclude from exclusion reason. * Delete cdpURLMapping. * Add jsdoc. Correct JSDoc. Remove tabFramesIdMap. * Use optional chaining. * Fix jsdoc comment in index.ts * Small refactoring * Assign target in the chrome.debugger event. * Add comments. --------- Co-authored-by: sayedtaqui <sayedwp@gmail.com>
- Loading branch information
Showing
45 changed files
with
3,112 additions
and
1,129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19487,4 +19487,4 @@ | |
"wildcard": "0" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
/** | ||
* This function will attach the debugger to the given target. | ||
* @param {{ [key: string]: number | string }} target The target where debugger needs to be attached. | ||
*/ | ||
export default async function attachCDP(target: { | ||
[key: string]: number | string; | ||
}) { | ||
try { | ||
await chrome.debugger.attach(target, '1.3'); | ||
await chrome.debugger.sendCommand(target, 'Target.setAutoAttach', { | ||
// If this is set to true, debugger will be attached to every new target that is added to the current target. | ||
autoAttach: true, | ||
waitForDebuggerOnStart: false, | ||
//Enables "flat" access to the session via specifying sessionId attribute in the commands. | ||
// If this is set to true the debugger is also attached to the child targets of that the target it has been attached to. | ||
flatten: true, | ||
}); | ||
await chrome.debugger.sendCommand(target, 'Network.enable'); | ||
await chrome.debugger.sendCommand(target, 'Audits.enable'); | ||
await chrome.debugger.sendCommand(target, 'Page.enable'); | ||
} catch (error) { | ||
//Fail silently | ||
} | ||
} |
Oops, something went wrong.