Git Product home page Git Product logo

Comments (9)

sirdarckcat avatar sirdarckcat commented on May 3, 2024 1

https://chromium-review.googlesource.com/c/chromium/src/+/2410339 graduates the Fetch domain to non-experimental. This (hopefully) means that in 6 weeks (ish) we'll have them on stable.

from tamperchrome.

sirdarckcat avatar sirdarckcat commented on May 3, 2024

if that doesn't work out, this could be used instead: https://bugs.chromium.org/p/chromium/issues/detail?id=702384

from tamperchrome.

sirdarckcat avatar sirdarckcat commented on May 3, 2024

started experimenting with Network.setRequestInterception using the debugger API. The API isn't really ready yet (it's on tip-of-tree), and I wasn't able to "enable" interception with this code:

chrome.browserAction.onClicked.addListener(async tab=>{
  let target = {tabId: tab.id};

  await new Promise((res, err)=>chrome.debugger.attach(target, "1.2", result=>{
    if (chrome.runtime.lastError) {
      err(chrome.runtime.lastError);
    } else {
      res(result);
    }
  }));

  chrome.debugger.onEvent.addListener((source,method,params)=>{
    console.log('THIS IS NEVER CALLED with request interception', method, params);
  });

  chrome.debugger.onDetach.addListener((source, reason)=> {
    console.log('detached', reason);
    if (source.tabId == tab.id) {
    }
  });
  
  sendCommand = (method, params) => new Promise((res, err)=>{
    chrome.debugger.sendCommand(target, method, params, result=>{
      if (chrome.runtime.lastError) {
        err(chrome.runtime.lastError);
      } else {
        res(result);
      }
      console.log(method);
    });
  });
  
  await sendCommand("Network.enable", {});
  await sendCommand("Network.setRequestInterception", {patterns:[{urlPattern: "*"}]});
});

Also, it adds an annoying yellow bar at the top.

from tamperchrome.

sirdarckcat avatar sirdarckcat commented on May 3, 2024

the aforementioned code works now.

chrome.browserAction.onClicked.addListener(async tab=>{
  let target = {tabId: tab.id};

  await new Promise((res, err)=>chrome.debugger.attach(target, "1.3", result=>{
    if (chrome.runtime.lastError) {
      err(chrome.runtime.lastError);
    } else {
      res(result);
    }
  }));

  chrome.debugger.onEvent.addListener(async (source,method,params)=>{
    console.log('onEvent', method, params);
    switch(method) {
        case "Network.requestIntercepted":
            await sendCommand("Network.continueInterceptedRequest", {interceptionId: params.interceptionId});
            break;
    }
  });

  chrome.debugger.onDetach.addListener((source, reason)=> {
    console.log('detached', reason);
    if (source.tabId == tab.id) {
    }
  });
  
  sendCommand = (method, params) => new Promise((res, err)=>{
    chrome.debugger.sendCommand(target, method, params, result=>{
      if (chrome.runtime.lastError) {
        err(chrome.runtime.lastError);
      } else {
        res(result);
      }
      console.log('sendCommand', method, params);
    });
  });
  
  await sendCommand("Network.setCacheDisabled", {cacheDisabled: true});
  await sendCommand("Network.setRequestInterception", {patterns:[{urlPattern: '*', interceptionStage: 'Request'}, {urlPattern: '*', interceptionStage: 'HeadersReceived'}]});
});

from tamperchrome.

sirdarckcat avatar sirdarckcat commented on May 3, 2024

according to https://bugs.chromium.org/p/chromium/issues/detail?id=932674#c5 Fetch protocol domain is meant to replace setRequestInterception

from tamperchrome.

sirdarckcat avatar sirdarckcat commented on May 3, 2024

https://chromedevtools.github.io/devtools-protocol/tot/Fetch

from tamperchrome.

sirdarckcat avatar sirdarckcat commented on May 3, 2024

#40 has the first round of experimentation. will clean it up and then it's the turn of the UI

from tamperchrome.

sirdarckcat avatar sirdarckcat commented on May 3, 2024

https://bugs.chromium.org/p/chromium/issues/detail?id=1068499 tracks the use of tot in extensions

from tamperchrome.

sirdarckcat avatar sirdarckcat commented on May 3, 2024

Fetch.fulfillRequest seems to be broken, but other than that, continueRequest works, so we can at least modify requests. I'll try to get a version of TamperChrome that works with requests at least.

Since it's on stable now, we can close this, and track what's left on #40

from tamperchrome.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.