From 351a5bf677e7ac4fb61f8a8101510b8528ad54f9 Mon Sep 17 00:00:00 2001 From: Mihai Alexandru Michis Date: Wed, 30 Oct 2019 11:15:36 +0200 Subject: [PATCH] Backed out changeset ed867296b6d4 (bug 1591900) for causing mochitest fission failures in test_ext_activityLog.html CLOSED TREE --- dom/chrome-webidl/ChannelWrapper.webidl | 7 ----- .../extensions/ProxyChannelFilter.jsm | 1 - .../components/extensions/schemas/proxy.json | 5 ++- .../extensions/schemas/web_request.json | 31 +++++++------------ .../test/mochitest/file_third_party.html | 11 +------ .../test_ext_request_urlClassification.html | 28 +++++------------ .../extensions/webrequest/ChannelWrapper.cpp | 21 ------------- .../extensions/webrequest/ChannelWrapper.h | 2 -- .../extensions/webrequest/WebRequest.jsm | 2 -- 9 files changed, 21 insertions(+), 87 deletions(-) diff --git a/dom/chrome-webidl/ChannelWrapper.webidl b/dom/chrome-webidl/ChannelWrapper.webidl index 33dee16e23d4..6739918100cc 100644 --- a/dom/chrome-webidl/ChannelWrapper.webidl +++ b/dom/chrome-webidl/ChannelWrapper.webidl @@ -410,13 +410,6 @@ interface ChannelWrapper : EventTarget { */ [Cached, Frozen, GetterThrows, Pure] readonly attribute MozUrlClassification? urlClassification; - - /** - * Indicates if this response and its content window hierarchy is third - * party. - */ - [Cached, Constant] - readonly attribute boolean thirdParty; }; /** diff --git a/toolkit/components/extensions/ProxyChannelFilter.jsm b/toolkit/components/extensions/ProxyChannelFilter.jsm index 069cd4c61718..e261b2d705ff 100644 --- a/toolkit/components/extensions/ProxyChannelFilter.jsm +++ b/toolkit/components/extensions/ProxyChannelFilter.jsm @@ -286,7 +286,6 @@ class ProxyChannelFilter { type: channel.type, fromCache: !!channel.fromCache, incognito: originAttributes && originAttributes.privateBrowsingId > 0, - thirdParty: channel.thirdParty, originUrl: channel.originURL || undefined, documentUrl: channel.documentURL || undefined, diff --git a/toolkit/components/extensions/schemas/proxy.json b/toolkit/components/extensions/schemas/proxy.json index 9ecf7fbefe64..ef33cba8f0ed 100644 --- a/toolkit/components/extensions/schemas/proxy.json +++ b/toolkit/components/extensions/schemas/proxy.json @@ -120,8 +120,7 @@ "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."}, "fromCache": {"type": "boolean", "description": "Indicates if this response was fetched from disk cache."}, "requestHeaders": {"$ref": "webRequest.HttpHeaders", "optional": true, "description": "The HTTP request headers that are going to be sent out with this request."}, - "urlClassification": {"$ref": "webRequest.UrlClassification", "description": "Url classification if the request has been classified."}, - "thirdParty": {"type": "boolean", "description": "Indicates if this request and its content window hierarchy is third party."} + "urlClassification": {"$ref": "webRequest.UrlClassification", "description": "Url classification if the request has been classified."} } } ], @@ -168,4 +167,4 @@ } ] } -] +] \ No newline at end of file diff --git a/toolkit/components/extensions/schemas/web_request.json b/toolkit/components/extensions/schemas/web_request.json index aada27115f39..13d514354d63 100644 --- a/toolkit/components/extensions/schemas/web_request.json +++ b/toolkit/components/extensions/schemas/web_request.json @@ -366,8 +366,8 @@ "id": "UrlClassification", "type": "object", "properties": { - "firstParty": {"$ref": "UrlClassificationParty", "description": "Classification flags if the request has been classified and it is first party."}, - "thirdParty": {"$ref": "UrlClassificationParty", "description": "Classification flags if the request has been classified and it or its window hierarchy is third party."} + "firstParty": {"$ref": "UrlClassificationParty", "description": "First party classification flags if the request has been classified."}, + "thirdParty": {"$ref": "UrlClassificationParty", "description": "Third party classification flags if the request has been classified."} } } ], @@ -479,8 +479,7 @@ "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."}, "type": {"$ref": "ResourceType", "description": "How the requested resource will be used."}, "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."}, - "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."}, - "thirdParty": {"type": "boolean", "description": "Indicates if this request and its content window hierarchy is third party."} + "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."} } } ], @@ -528,8 +527,7 @@ "type": {"$ref": "ResourceType", "description": "How the requested resource will be used."}, "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."}, "requestHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP request headers that are going to be sent out with this request."}, - "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."}, - "thirdParty": {"type": "boolean", "description": "Indicates if this request and its content window hierarchy is third party."} + "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."} } } ], @@ -577,8 +575,7 @@ "type": {"$ref": "ResourceType", "description": "How the requested resource will be used."}, "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."}, "requestHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP request headers that have been sent out with this request."}, - "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."}, - "thirdParty": {"type": "boolean", "description": "Indicates if this request and its content window hierarchy is third party."} + "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."} } } ], @@ -623,8 +620,7 @@ "statusLine": {"type": "string", "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line)."}, "responseHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP response headers that have been received with this response."}, "statusCode": {"type": "integer", "description": "Standard HTTP status code returned by the server."}, - "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."}, - "thirdParty": {"type": "boolean", "description": "Indicates if this request and its content window hierarchy is third party."} + "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."} } } ], @@ -678,8 +674,7 @@ "responseHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP response headers that were received along with this response."}, "statusLine": {"type": "string", "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers."}, "statusCode": {"type": "integer", "description": "Standard HTTP status code returned by the server."}, - "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."}, - "thirdParty": {"type": "boolean", "description": "Indicates if this request and its content window hierarchy is third party."} + "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."} } }, { @@ -739,8 +734,7 @@ "statusCode": {"type": "integer", "description": "Standard HTTP status code returned by the server."}, "responseHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP response headers that were received along with this response."}, "statusLine": {"type": "string", "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers."}, - "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."}, - "thirdParty": {"type": "boolean", "description": "Indicates if this request and its content window hierarchy is third party."} + "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."} } } ], @@ -788,8 +782,7 @@ "redirectUrl": {"type": "string", "description": "The new URL."}, "responseHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP response headers that were received along with this redirect."}, "statusLine": {"type": "string", "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers."}, - "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."}, - "thirdParty": {"type": "boolean", "description": "Indicates if this request and its content window hierarchy is third party."} + "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."} } } ], @@ -836,8 +829,7 @@ "statusCode": {"type": "integer", "description": "Standard HTTP status code returned by the server."}, "responseHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP response headers that were received along with this response."}, "statusLine": {"type": "string", "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers."}, - "urlClassification": {"$ref": "UrlClassification","description": "Tracking classification if the request has been classified."}, - "thirdParty": {"type": "boolean", "description": "Indicates if this request and its content window hierarchy is third party."} + "urlClassification": {"$ref": "UrlClassification","description": "Tracking classification if the request has been classified."} } } ], @@ -882,8 +874,7 @@ "ip": {"type": "string", "optional": true, "description": "The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address."}, "fromCache": {"type": "boolean", "description": "Indicates if this response was fetched from disk cache."}, "error": {"type": "string", "description": "The error description. This string is not guaranteed to remain backwards compatible between releases. You must not parse and act based upon its content."}, - "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."}, - "thirdParty": {"type": "boolean", "description": "Indicates if this request and its content window hierarchy is third party."} + "urlClassification": {"$ref": "UrlClassification", "optional": true, "description": "Tracking classification if the request has been classified."} } } ], diff --git a/toolkit/components/extensions/test/mochitest/file_third_party.html b/toolkit/components/extensions/test/mochitest/file_third_party.html index fc5a3262970b..d39c5b017665 100644 --- a/toolkit/components/extensions/test/mochitest/file_third_party.html +++ b/toolkit/components/extensions/test/mochitest/file_third_party.html @@ -6,16 +6,7 @@ - + diff --git a/toolkit/components/extensions/test/mochitest/test_ext_request_urlClassification.html b/toolkit/components/extensions/test/mochitest/test_ext_request_urlClassification.html index 804ecdc4a45f..2c3950621687 100644 --- a/toolkit/components/extensions/test/mochitest/test_ext_request_urlClassification.html +++ b/toolkit/components/extensions/test/mochitest/test_ext_request_urlClassification.html @@ -35,11 +35,9 @@ add_task(async function test_urlClassification() { isPrivileged: true, background() { let expected = { - "http://tracking.example.org/": {first: "tracking", thirdParty: false, }, - "http://mochi.test:8888/tests/toolkit/components/extensions/test/mochitest/file_third_party.html?domain=tracking.example.org": { thirdParty: false, }, - "http://tracking.example.org/tests/toolkit/components/extensions/test/mochitest/file_image_bad.png": {third: "tracking", thirdParty: true, }, - "http://mochi.test:8888/tests/toolkit/components/extensions/test/mochitest/file_third_party.html?domain=example.net": { thirdParty: false, }, - "http://example.net/tests/toolkit/components/extensions/test/mochitest/file_image_bad.png": { thirdParty: true, }, + "http://tracking.example.org/": {first: "tracking"}, + "http://mochi.test:8888/tests/toolkit/components/extensions/test/mochitest/file_third_party.html": {}, + "http://tracking.example.org/tests/toolkit/components/extensions/test/mochitest/file_image_bad.png": {third: "tracking"}, }; function testRequest(details) { let expect = expected[details.url]; @@ -54,8 +52,6 @@ add_task(async function test_urlClassification() { } else { browser.test.assertEq(details.urlClassification.thirdParty.length, 0, "not tracking thirdParty"); } - - browser.test.assertEq(details.thirdParty, expect.thirdParty, "3rd party flag matches"); return true; } return false; @@ -64,17 +60,17 @@ add_task(async function test_urlClassification() { browser.proxy.onRequest.addListener(details => { browser.test.log(`proxy.onRequest ${JSON.stringify(details)}`); testRequest(details); - }, {urls: ["http://mochi.test/tests/*", "http://tracking.example.org/*", "http://example.net/*"]}); + }, {urls: ["http://mochi.test/tests/*", "http://tracking.example.org/*"]}); browser.webRequest.onBeforeRequest.addListener(async (details) => { browser.test.log(`webRequest.onBeforeRequest ${JSON.stringify(details)}`); testRequest(details); - }, {urls: ["http://mochi.test/tests/*", "http://tracking.example.org/*", "http://example.net/*"]}, ["blocking"]); + }, {urls: ["http://mochi.test/tests/*", "http://tracking.example.org/*"]}, ["blocking"]); browser.webRequest.onCompleted.addListener(async (details) => { browser.test.log(`webRequest.onCompleted ${JSON.stringify(details)}`); if (testRequest(details)) { browser.test.sendMessage("classification", details.url); } - }, {urls: ["http://mochi.test/tests/*", "http://tracking.example.org/*", "http://example.net/*"]}); + }, {urls: ["http://mochi.test/tests/*", "http://tracking.example.org/*"]}); }, }); await extension.startup(); @@ -84,9 +80,8 @@ add_task(async function test_urlClassification() { let win = window.open(url); is(await extension.awaitMessage("classification"), url, "request completed"); win.close(); - // Test third party tracking classification, expecting two results. - url = "http://mochi.test:8888/tests/toolkit/components/extensions/test/mochitest/file_third_party.html?domain=tracking.example.org"; + url = "http://mochi.test:8888/tests/toolkit/components/extensions/test/mochitest/file_third_party.html"; win = window.open(url); is(await extension.awaitMessage("classification"), url); is(await extension.awaitMessage("classification"), @@ -94,15 +89,6 @@ add_task(async function test_urlClassification() { "request completed"); win.close(); - // Test third party tracking classification, expecting two results. - url = "http://mochi.test:8888/tests/toolkit/components/extensions/test/mochitest/file_third_party.html?domain=example.net"; - win = window.open(url); - is(await extension.awaitMessage("classification"), url); - is(await extension.awaitMessage("classification"), - "http://example.net/tests/toolkit/components/extensions/test/mochitest/file_image_bad.png", - "request completed"); - win.close(); - await extension.unload(); }); diff --git a/toolkit/components/extensions/webrequest/ChannelWrapper.cpp b/toolkit/components/extensions/webrequest/ChannelWrapper.cpp index 3b297abd45d7..2bb45c231468 100644 --- a/toolkit/components/extensions/webrequest/ChannelWrapper.cpp +++ b/toolkit/components/extensions/webrequest/ChannelWrapper.cpp @@ -23,7 +23,6 @@ #include "mozilla/dom/Element.h" #include "mozilla/dom/Event.h" #include "mozilla/dom/BrowserHost.h" -#include "mozIThirdPartyUtil.h" #include "nsIContentPolicy.h" #include "nsIClassifiedChannel.h" #include "nsIHttpChannelInternal.h" @@ -926,26 +925,6 @@ void ChannelWrapper::GetUrlClassification( aRetVal.SetValue(std::move(classification)); } -bool ChannelWrapper::ThirdParty() const { - nsCOMPtr thirdPartyUtil = services::GetThirdPartyUtil(); - if (NS_WARN_IF(!thirdPartyUtil)) { - return true; - } - - nsCOMPtr chan = MaybeHttpChannel(); - if (!chan) { - return false; - } - - bool thirdParty = false; - nsresult rv = thirdPartyUtil->IsThirdPartyChannel(chan, nullptr, &thirdParty); - if (NS_WARN_IF(NS_FAILED(rv))) { - return true; - } - - return thirdParty; -} - /***************************************************************************** * Error handling *****************************************************************************/ diff --git a/toolkit/components/extensions/webrequest/ChannelWrapper.h b/toolkit/components/extensions/webrequest/ChannelWrapper.h index 94fa3fa2a87a..e5698d05f375 100644 --- a/toolkit/components/extensions/webrequest/ChannelWrapper.h +++ b/toolkit/components/extensions/webrequest/ChannelWrapper.h @@ -230,8 +230,6 @@ class ChannelWrapper final : public DOMEventTargetHelper, void GetUrlClassification(dom::Nullable& aRetVal, ErrorResult& aRv) const; - bool ThirdParty() const; - using EventTarget::EventListenerAdded; using EventTarget::EventListenerRemoved; virtual void EventListenerAdded(nsAtom* aType) override; diff --git a/toolkit/components/extensions/webrequest/WebRequest.jsm b/toolkit/components/extensions/webrequest/WebRequest.jsm index 13b9f03bdea0..cdb5b9b479ee 100644 --- a/toolkit/components/extensions/webrequest/WebRequest.jsm +++ b/toolkit/components/extensions/webrequest/WebRequest.jsm @@ -231,7 +231,6 @@ function serializeRequestData(eventName) { timeStamp: Date.now(), frameId: this.windowId, parentFrameId: this.parentWindowId, - thirdParty: this.thirdParty, }; if (MAYBE_CACHED_EVENTS.has(eventName)) { @@ -769,7 +768,6 @@ HttpObserverManager = { type: channel.type, fromCache: channel.fromCache, originAttributes, - thirdParty: channel.thirdParty, originUrl: channel.originURL || undefined, documentUrl: channel.documentURL || undefined,