Bug 942774 - Fix files loaded into scratchpad to be recognized as "saved". r=benvie
authorPeiyong Lin <pylaurent1314@gmail.com>
Wed, 22 Jan 2014 10:23:21 -0800
changeset 164788 cbb2876bdaf35266f1521bb72cb928ab884da68e
parent 164787 0c921868e9c59c3fdad70aedf55d3c2f69f4af54
child 164789 530cd49cb5d8c5cbc3dfd272d70d0b2943c8684e
push id26061
push usercbook@mozilla.com
push dateThu, 23 Jan 2014 09:19:45 +0000
treeherdermozilla-central@96e031fede3f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbenvie
bugs942774
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 942774 - Fix files loaded into scratchpad to be recognized as "saved". r=benvie
browser/devtools/scratchpad/scratchpad.js
browser/devtools/scratchpad/test/browser_scratchpad_files.js
--- a/browser/devtools/scratchpad/scratchpad.js
+++ b/browser/devtools/scratchpad/scratchpad.js
@@ -977,16 +977,17 @@ var Scratchpad = {
         let chrome = Services.prefs.getBoolPref(DEVTOOLS_CHROME_ENABLED);
 
         if (chrome && modeline["-sp-context"] === "browser") {
           this.setBrowserContext();
         }
 
         this.editor.setText(content);
         this.editor.clearHistory();
+        this.dirty = false;
         document.getElementById("sp-cmd-revert").setAttribute("disabled", true);
       }
       else if (!aSilentError) {
         window.alert(this.strings.GetStringFromName("openFile.failed"));
       }
 
       if (aCallback) {
         aCallback.call(this, aStatus, content);
--- a/browser/devtools/scratchpad/test/browser_scratchpad_files.js
+++ b/browser/devtools/scratchpad/test/browser_scratchpad_files.js
@@ -48,16 +48,19 @@ function fileImported(aStatus, aFileCont
      "the temporary file was imported successfully with Scratchpad");
 
   is(aFileContent, gFileContent,
      "received data is correct");
 
   is(gScratchpad.getText(), gFileContent,
      "the editor content is correct");
 
+  is(gScratchpad.dirty, false,
+     "the editor marks imported file as saved");
+
   // Save the file after changes.
   gFileContent += "// omg, saved!";
   gScratchpad.editor.setText(gFileContent);
 
   gScratchpad.exportToFile(gFile.QueryInterface(Ci.nsILocalFile), true, true,
                           fileExported);
 }