2018-03-20

2018-03-20 10:26 pm
Entry tags:

newish JavaScript syntax

Some stuff for me to learn.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#Object_literals

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment

My initial reaction to some of those examples is stunned disbelief. Why would you want to allow defining a property whose name is an empty string, an exclamation mark, or a number? And why would you use array syntax, [], for those, when they aren't arrays? So that "car[7]" is not necessarily the 7th item in a car array, but might be a car property by the name of 7?

Yeah. How fun.
2018-03-20 10:48 pm
Entry tags:

Overriding the URL for new tabs in Firefox, updated

As of Firefox version 59, the syntax listed in my prior post no longer works for overriding the new tab URL.

The "local-settings.js" file can remain the same as before.

But the "mozilla.cfg" file instead needs syntax like this now:

var {classes:Cc, interfaces:Ci, utils:Cu} = Components;

try {
   var newTabURL = "file:///C:/path/to/html/file.htm";
   aboutNewTabService = Cc["@mozilla.org/browser/aboutnewtab-service;1"].getService(Ci.nsIAboutNewTabService);
   aboutNewTabService.newTabURL = newTabURL;
   pref("browser.newtab.url", aboutNewTabService.newTabURL);
} catch(e) {
   Cu.reportError(e);
}


The above info was posted by user "cor-el" on this page:
https://support.mozilla.org/eu/questions/1202974