RequestPolicyContinued/requestpolicy

[WebExtension port] move from nsIContentPolicy etc. to WebRequest etc.

myrdd opened this issue · 0 comments

myrdd commented

One important current question is: On a page load— when a new page is replaced by an old one —how to determine whether a request belongs to the new or the old page?
I'm probably going to use some uBO code here. uBO's implementation includes:

  • PageRequestStore objects are used to store net requests
    • in RPC, this is the RequestMemory
  • tabContextManager keeps track (as accurately as possible) of which root document belongs to which tab
    • tabContexts: Map<tabId, TabContext>
  • connecting logic in … (reverse call tree)
    • bindTabToPageStats()
      • onHeadersReceived (traffic.js) — context="beforeRequest"
        • httpObserver.handleResponseHeaders (platform/firefox/vapi-background.js)
        • onHeadersReceived (platform/webext/vapi-webrequest.js)
      • onBeforeRootFrameRequest / onBeforeRequest (traffic.js) — context="beforeRequest"
        • httpObserver.handleRequest (platform/firefox/vapi-background.js)
        • onBeforeRequest (platform/webext/vapi-webrequest.js)
      • onUpdated (tab.js) — context="tabUpdated"
        • locationChangedListener (platform/firefox/vapi-background.js)
      • onNavigation (tab.js) — context="tabCommitted"
        • locationChangedListener (platform/firefox/vapi-background.js)
        • onBeforeRequest (traffic.js)
  • µb tab.js
    • normalizeRequestDetails: essentially, set anyTabId, which is checked against only in onBeforeBehindTheSceneRequest (traffic.js)
  • µb tab.js
    • updateBadgeAsync = updateBlockedContentStateAfterTimeout

These are the subtasks of this issue (incomplete)

  • test TabContextManager
    • create/copy TabContext class
    • create/copy Context class
    • create "tabs.contexts" module
    • vAPI functions -> own functions
    • µb functions -> own functions
      • the functions
        • µb.normalizePageURL()
        • µb.URI.hostnameFromURI()
        • µb.URI.domainFromHostname()
      • create the TabContext properties
        • normalURL
        • rootHostname
        • rootDomain
      • , respectively.
      • which of those properties do we need on lookup() invocations?
    • call commit() and push()
      • uBO calls these functions in
        • onBeforeRootFrameRequest
        • onHeadersReceived
        • tabs.onUpdated
        • tabs.onNavigation