Added in some code to expose the path to the os default application. Tested via tests on Windows. Mac and Linux will use the nsMIMEInfoImpl which will supply the functionality for them and be tested with the auto-tests.
Differential Revision: https://phabricator.services.mozilla.com/D204306
Some code to exercise this in the browser console:
```
{
const printNames = async (appList) => {
let buffer = "Start:\n";
for (let index = 0; index < appList4.length; index++) {
let app = appList4.queryElementAt(index, Ci.nsILocalHandlerApp);
buffer += app.executable.leafName;
buffer += "\n";
}
buffer += "\n";
for (let index = 0; index < appList4.length; index++) {
let app = appList4.queryElementAt(index, Ci.nsILocalHandlerApp);
let prettyName = await app.prettyNameAsync();
buffer += prettyName;
buffer += "\n";
}
buffer += "\n";
for (let index = 0; index < appList4.length; index++) {
let app = appList4.queryElementAt(index, Ci.nsILocalHandlerApp);
buffer += app.executable.displayName;
buffer += "\n";
}
buffer += "\n";
for (let index = 0; index < appList4.length; index++) {
let app = appList4.queryElementAt(index, Ci.nsILocalHandlerApp);
if (AppConstants.platform == "win") {
let file = app.executable;
if (file instanceof Ci.nsILocalFileWin) {
try {
buffer += file.getVersionInfoField("FileDescription");
} catch (e) {
}
}
}
buffer += "\n";
}
buffer += "\nEnd\n";
console.log(buffer);
};
const lazy4 = {};
XPCOMUtils.defineLazyServiceGetters(lazy4, {
gMIMEService: ["@mozilla.org/mime;1", "nsIMIMEService"],
});
let mimeInfo4 = lazy4.gMIMEService.getFromTypeAndExtension("text/html", "html");
if (mimeInfo4.hasDefaultHandler) {
console.log(`HasDefaultHandler = true`);
console.log(`Description = ${mimeInfo4.defaultDescription}`);
} else {
console.log(`HasDefaultHandler = false`);
}
let appList4 = mimeInfo4.possibleLocalHandlers || [];
console.log("appList4 = ");
console.log(JSON.stringify(appList4));
printNames(appList4);
}
```
That produces output that can be seen in a pretty form here:
https://docs.google.com/spreadsheets/d/1OvtrZgMlPMJO4Wgu6wwAYvm89orj9HdS_tsDxYn7yrA/edit#gid=0
This does not fix-up things so that all calls to getName() on the LocalHandlerApp are switched to prettyNameAsync. That work is tracked here: https://bugzilla.mozilla.org/show_bug.cgi?id=1884267
Differential Revision: https://phabricator.services.mozilla.com/D203876
Some code to exercise this in the browser console:
```
{
const printNames = async (appList) => {
let buffer = "Start:\n";
for (let index = 0; index < appList4.length; index++) {
let app = appList4.queryElementAt(index, Ci.nsILocalHandlerApp);
buffer += app.executable.leafName;
buffer += "\n";
}
buffer += "\n";
for (let index = 0; index < appList4.length; index++) {
let app = appList4.queryElementAt(index, Ci.nsILocalHandlerApp);
let prettyName = await app.prettyNameAsync();
buffer += prettyName;
buffer += "\n";
}
buffer += "\n";
for (let index = 0; index < appList4.length; index++) {
let app = appList4.queryElementAt(index, Ci.nsILocalHandlerApp);
buffer += app.executable.displayName;
buffer += "\n";
}
buffer += "\n";
for (let index = 0; index < appList4.length; index++) {
let app = appList4.queryElementAt(index, Ci.nsILocalHandlerApp);
if (AppConstants.platform == "win") {
let file = app.executable;
if (file instanceof Ci.nsILocalFileWin) {
try {
buffer += file.getVersionInfoField("FileDescription");
} catch (e) {
}
}
}
buffer += "\n";
}
buffer += "\nEnd\n";
console.log(buffer);
};
const lazy4 = {};
XPCOMUtils.defineLazyServiceGetters(lazy4, {
gMIMEService: ["@mozilla.org/mime;1", "nsIMIMEService"],
});
let mimeInfo4 = lazy4.gMIMEService.getFromTypeAndExtension("text/html", "html");
if (mimeInfo4.hasDefaultHandler) {
console.log(`HasDefaultHandler = true`);
console.log(`Description = ${mimeInfo4.defaultDescription}`);
} else {
console.log(`HasDefaultHandler = false`);
}
let appList4 = mimeInfo4.possibleLocalHandlers || [];
console.log("appList4 = ");
console.log(JSON.stringify(appList4));
printNames(appList4);
}
```
That produces output that can be seen in a pretty form here:
https://docs.google.com/spreadsheets/d/1OvtrZgMlPMJO4Wgu6wwAYvm89orj9HdS_tsDxYn7yrA/edit#gid=0
This does not fix-up things so that all calls to getName() on the LocalHandlerApp are switched to prettyNameAsync. That work is tracked here: https://bugzilla.mozilla.org/show_bug.cgi?id=1884267
Differential Revision: https://phabricator.services.mozilla.com/D203876
Added in some code to expose the path to the os default application. Tested via tests on Windows. Mac and Linux will use the nsMIMEInfoImpl which will supply the functionality for them and be tested with the auto-tests.
Differential Revision: https://phabricator.services.mozilla.com/D204306
Some code to exercise this in the browser console:
```
{
const printNames = async (appList) => {
let buffer = "Start:\n";
for (let index = 0; index < appList4.length; index++) {
let app = appList4.queryElementAt(index, Ci.nsILocalHandlerApp);
buffer += app.executable.leafName;
buffer += "\n";
}
buffer += "\n";
for (let index = 0; index < appList4.length; index++) {
let app = appList4.queryElementAt(index, Ci.nsILocalHandlerApp);
let prettyName = await app.prettyNameAsync();
buffer += prettyName;
buffer += "\n";
}
buffer += "\n";
for (let index = 0; index < appList4.length; index++) {
let app = appList4.queryElementAt(index, Ci.nsILocalHandlerApp);
buffer += app.executable.displayName;
buffer += "\n";
}
buffer += "\n";
for (let index = 0; index < appList4.length; index++) {
let app = appList4.queryElementAt(index, Ci.nsILocalHandlerApp);
if (AppConstants.platform == "win") {
let file = app.executable;
if (file instanceof Ci.nsILocalFileWin) {
try {
buffer += file.getVersionInfoField("FileDescription");
} catch (e) {
}
}
}
buffer += "\n";
}
buffer += "\nEnd\n";
console.log(buffer);
};
const lazy4 = {};
XPCOMUtils.defineLazyServiceGetters(lazy4, {
gMIMEService: ["@mozilla.org/mime;1", "nsIMIMEService"],
});
let mimeInfo4 = lazy4.gMIMEService.getFromTypeAndExtension("text/html", "html");
if (mimeInfo4.hasDefaultHandler) {
console.log(`HasDefaultHandler = true`);
console.log(`Description = ${mimeInfo4.defaultDescription}`);
} else {
console.log(`HasDefaultHandler = false`);
}
let appList4 = mimeInfo4.possibleLocalHandlers || [];
console.log("appList4 = ");
console.log(JSON.stringify(appList4));
printNames(appList4);
}
```
That produces output that can be seen in a pretty form here:
https://docs.google.com/spreadsheets/d/1OvtrZgMlPMJO4Wgu6wwAYvm89orj9HdS_tsDxYn7yrA/edit#gid=0
This does not fix-up things so that all calls to getName() on the LocalHandlerApp are switched to prettyNameAsync. That work is tracked here: https://bugzilla.mozilla.org/show_bug.cgi?id=1884267
Differential Revision: https://phabricator.services.mozilla.com/D203876
Add a separate check for spec breaking allows of certain MIME
types. Having this separated out means that we can make the rest of
the implementation behave exactly like spec.
Some tradeoffs that we need in the current state are:
* Allowing "application/dash+xml"
* Allowing "application/vnd.apple.mpegurl"
* Allowing "text/vtt"
* Allow all MIME types beginning with "audio/mpeg"
* Allow "text/plain" when there is a no-sniff header.
Differential Revision: https://phabricator.services.mozilla.com/D176821
This patch starts to actually blocking opaque responses
for most type of the resources that are defined in the spec.
There are still pieces missing such as blocking JSON responses,
and this is why it's called partially implemented.
This patch was originally written by farre, and I made some
modifications based on it.
Depends on D155128
Differential Revision: https://phabricator.services.mozilla.com/D155129
-Wshadow warnings are not enabled globally, so these -Wno-shadow suppressions have no effect. I had intended to enable -Wshadow globally along with these suppressions in some directories (in bug 1272513), but that was blocked by other issues.
There are too many -Wshadow warnings (now over 2000) to realistically fix them all. We should remove all these unnecessary -Wno-shadow flags cluttering many moz.build files.
Differential Revision: https://phabricator.services.mozilla.com/D132289