Backed out changeset ed867296b6d4 (bug 1591900) for causing mochitest fission failures in test_ext_activityLog.html CLOSED TREE

This commit is contained in:
Mihai Alexandru Michis 2019-10-30 11:15:36 +02:00
parent b733e3b3ac
commit 351a5bf677
9 changed files with 21 additions and 87 deletions

View File

@ -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;
};
/**

View File

@ -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,

View File

@ -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 @@
}
]
}
]
]

View File

@ -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 <em>not</em> 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."}
}
}
],

View File

@ -6,16 +6,7 @@
</head>
<body>
<script>
"use strict"
let url = new URL(location);
let img = new Image();
img.src = `http://${url.searchParams.get("domain")}/tests/toolkit/components/extensions/test/mochitest/file_image_bad.png`;
document.body.appendChild(img);
</script>
<img id="tracking-image" src="http://tracking.example.org/tests/toolkit/components/extensions/test/mochitest/file_image_bad.png" />
</body>
</html>

View File

@ -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();
});

View File

@ -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<mozIThirdPartyUtil> thirdPartyUtil = services::GetThirdPartyUtil();
if (NS_WARN_IF(!thirdPartyUtil)) {
return true;
}
nsCOMPtr<nsIHttpChannel> 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
*****************************************************************************/

View File

@ -230,8 +230,6 @@ class ChannelWrapper final : public DOMEventTargetHelper,
void GetUrlClassification(dom::Nullable<dom::MozUrlClassification>& aRetVal,
ErrorResult& aRv) const;
bool ThirdParty() const;
using EventTarget::EventListenerAdded;
using EventTarget::EventListenerRemoved;
virtual void EventListenerAdded(nsAtom* aType) override;

View File

@ -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,