mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 01:35:35 +00:00
Bug 1576252 move urlClassification to per-extension request data r=rpl
Differential Revision: https://phabricator.services.mozilla.com/D43290 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
57a2cad6e6
commit
aad9be688a
@ -16,6 +16,27 @@
|
||||
add_task(async function test_api() {
|
||||
let URL = "http://mochi.test:8888/tests/toolkit/components/extensions/test/mochitest/file_sample.html";
|
||||
|
||||
// Test that an unspecified extension is not logged by the watcher extension.
|
||||
let unlogged = ExtensionTestUtils.loadExtension({
|
||||
isPrivileged: true,
|
||||
manifest: {
|
||||
applications: { gecko: { id: "unlogged@tests.mozilla.org" } },
|
||||
permissions: ["webRequest", "webRequestBlocking", "<all_urls>"],
|
||||
},
|
||||
background() {
|
||||
// This privileged test extension should not affect the webRequest
|
||||
// data received by non-privileged extensions (See Bug 1576272).
|
||||
browser.webRequest.onBeforeRequest.addListener(
|
||||
details => {
|
||||
return { cancel: false };
|
||||
},
|
||||
{ urls: ["http://mochi.test/*/file_sample.html"] },
|
||||
["blocking"]
|
||||
);
|
||||
},
|
||||
});
|
||||
await unlogged.startup();
|
||||
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
applications: { gecko: { id: "watched@tests.mozilla.org" } },
|
||||
@ -280,6 +301,7 @@ add_task(async function test_api() {
|
||||
]);
|
||||
|
||||
await extension.unload();
|
||||
await unlogged.unload();
|
||||
await logger.unload();
|
||||
});
|
||||
|
||||
|
@ -757,7 +757,7 @@ HttpObserverManager = {
|
||||
}
|
||||
},
|
||||
|
||||
getRequestData(channel, extraData, policy) {
|
||||
getRequestData(channel, extraData) {
|
||||
let originAttributes =
|
||||
channel.loadInfo && channel.loadInfo.originAttributes;
|
||||
let data = {
|
||||
@ -784,12 +784,6 @@ HttpObserverManager = {
|
||||
serialize: serializeRequestData,
|
||||
};
|
||||
|
||||
// We're limiting access to
|
||||
// urlClassification while the feature is further fleshed out.
|
||||
if (policy && policy.extension.isPrivileged) {
|
||||
data.urlClassification = channel.urlClassification;
|
||||
}
|
||||
|
||||
return Object.assign(data, extraData);
|
||||
},
|
||||
|
||||
@ -845,7 +839,7 @@ HttpObserverManager = {
|
||||
}
|
||||
|
||||
if (!commonData) {
|
||||
commonData = this.getRequestData(channel, extraData, opts.extension);
|
||||
commonData = this.getRequestData(channel, extraData);
|
||||
if (this.STATUS_TYPES.has(kind)) {
|
||||
commonData.statusCode = channel.statusCode;
|
||||
commonData.statusLine = channel.statusLine;
|
||||
@ -853,6 +847,13 @@ HttpObserverManager = {
|
||||
}
|
||||
let data = Object.create(commonData);
|
||||
|
||||
// We're limiting access to urlClassification while the feature is
|
||||
// further fleshed out.
|
||||
let policy = opts.extension;
|
||||
if (policy && policy.extension.isPrivileged) {
|
||||
data.urlClassification = channel.urlClassification;
|
||||
}
|
||||
|
||||
if (registerFilter && opts.blocking && opts.extension) {
|
||||
data.registerTraceableChannel = (extension, remoteTab) => {
|
||||
// `channel` is a ChannelWrapper, which contains the actual
|
||||
|
Loading…
Reference in New Issue
Block a user