We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE


Poor example code

The example code pointed to from here, http://www.nexgenmedia.net/docs/protocol/ has several problems

  • defaultSearchURL is being modified on line 102 without having been declared.
  • On line 119 the code seems to be designed to continue even if it fails to read the preference. In fact running it throws this exception: [Search Protocol failed to get the search pref: [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIPrefBranch.getComplexValue]" nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)" location: "JS frame :: file:///.../testprotocol.js :: anonymous :: line 103" data: no]]
  • If you do create the preference (though no example for its value is given), this exception is thrown: [Search Protocol failed to get the search pref: TypeError: Components.classes['@mozilla.org/rdf/datasource;1?name=internetsearch'] is undefined]

This is the only protocol handler I can find in JavaScript and it seems to be far from straightforward for a newcomer to Mozilla hacking to translate a C++ example into JavaScript. — Hippietrail 16:33, 10 August 2008 (PDT)

It looks like it's far from straightforward to implement nsIProtocolHandler and especially nsIHttpChannel for a newcomer, in any language! The nsIChannel is not mentioning it's inheriting from nsIRequest, and the nsIRequest page is missing by the way. The NSGetModule page also hasn't been written, but is linked to from nsGetModuleProc. — StijnSanders 2008-11-05

Document Tags and Contributors

 Contributors to this page: develyoy, Hippietrail
 Last updated by: develyoy,