Last Comment Bug 168755 - [CasCadeS] inefficient code in SerializeExternalSheet
: [CasCadeS] inefficient code in SerializeExternalSheet
Status: RESOLVED FIXED
:
Product: SeaMonkey
Classification: Client Software
Component: Composer (show other bugs)
: Trunk
: All All
: -- normal (vote)
: ---
Assigned To: Daniel Glazman (:glazou)
:
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2002-09-14 21:51 PDT by Darin Fisher
Modified: 2008-07-31 02:09 PDT (History)
0 users
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments

Description Darin Fisher 2002-09-14 21:51:36 PDT
this code should not be creating a standard-url.

924 function SerializeExternalSheet(sheet, href)
925 {
926   var nsuri =
Components.classes["@mozilla.org/network/standard-url;1"].createInstance(Components.interfaces.nsIURI);
927   if (href)
928     nsuri.spec = href;
929   else
930     nsuri.spec = sheet.href;
931   var fileURL = nsuri.QueryInterface(Components.interfaces.nsIFileURL);
932   var localFile = fileURL.file;
933   var fileOuputStream =
Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);
934   try {
935     fileOuputStream.init(localFile, -1, -1, 0);

instead, you should replace it with something like the following:

var ios
  = Components.classes["@mozilla.org/network/io-service;1"]
              .getService(Components.interfaces.nsIIOService);
var fileHandler
  = ios.getProtocolHandler("file")
       .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
var localfile
  = fileHandler.getFileFromURLSpec(href);
Comment 1 Daniel Glazman (:glazou) 2002-09-15 02:24:08 PDT
Thanks for contributing and thanks for the hint, Darin :-)
Btw, the component for CaScadeS is Editor:Composer.
Changing. Accepting bug.
Comment 2 Daniel Glazman (:glazou) 2002-09-16 02:27:53 PDT
I was not fast enough : we now have a new component Editor:CSS Editor
Comment 3 Daniel Glazman (:glazou) 2002-11-06 08:23:35 PST
code added to CaScadeS and ready to check-in, thanks Darin.
Comment 4 Daniel Glazman (:glazou) 2002-11-07 03:12:22 PST
fix checked in trunk 11/07/2002 01:24

Note You need to log in before you can comment on or make changes to this bug.