Closed
Bug 644413
Opened 15 years ago
Closed 13 years ago
Scratchpads should be able to restore their context via mode-line
Categories
(DevTools Graveyard :: Scratchpad, defect, P2)
DevTools Graveyard
Scratchpad
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 21
People
(Reporter: rcampbell, Assigned: anton)
References
Details
(Keywords: dev-doc-needed)
Attachments
(1 file, 2 obsolete files)
|
9.17 KB,
patch
|
anton
:
review+
|
Details | Diff | Splinter Review |
When loading a .js file into a workspace, it currently defaults to "Content" context. We should make the Workspace respect a mode-line comment at the start of the file to indicate which context to use.
I'm thinking something like:
/* -ws-context: chrome */
initially.
This could also be used to save window state, color-schemes, etc.
| Reporter | ||
Comment 1•13 years ago
|
||
I think this is a dupe.
Component: Developer Tools → Developer Tools: Scratchpad
Summary: Workspaces should be able to restore their context via mode-line → Scratchpads should be able to restore their context via mode-line
| Reporter | ||
Updated•13 years ago
|
Whiteboard: [workspace] → [workspace][dupeme]
| Assignee | ||
Comment 2•13 years ago
|
||
I couldn't find any similar bug so I don't think it's a dupe?
Assignee: nobody → anton
Priority: -- → P2
| Assignee | ||
Comment 3•13 years ago
|
||
In addition to adding support for the -sp-context mode-line I moved file writing function from browser_scratchpad_files.js and into head.js so that I could reuse it.
Attachment #703094 -
Flags: review?(fayearthur)
| Assignee | ||
Updated•13 years ago
|
Whiteboard: [workspace][dupeme]
Comment 4•13 years ago
|
||
Comment on attachment 703094 [details] [diff] [review]
Add support for -sp-context mode-line
Review of attachment 703094 [details] [diff] [review]:
-----------------------------------------------------------------
Fix these couple things, and attach the modeline test so I can review that.
::: browser/devtools/scratchpad/scratchpad.js
@@ +64,5 @@
> + if (ch1 !== "/" || (ch2 !== "*" && ch2 !== "/")) {
> + return obj;
> + }
> +
> + aLine = aLine.slice(2, ch2 === "*" ? aLine.length - 2 : aLine.length);
either comment on what this is doing or do a regex replace(/*/, "") that might be more explicit.
@@ +69,5 @@
> + aLine.split(",").forEach(function (pair) {
> + let [key, val] = pair.split(":");
> +
> + if (key && val) {
> + obj[key.trim()] = val.trim();
trailing whitespace here
@@ +692,5 @@
> aInputStream.available());
> content = converter.ConvertToUnicode(content);
> +
> + // Check to see if the first line is a mode-line comment.
> + let line = content.split("\n")[0].trim();
You already call trim() in the scanModeLine() function, just need to do it in one of these places.
::: browser/devtools/scratchpad/test/browser_scratchpad_files.js
@@ +34,5 @@
>
> + createTempFile("fileForBug636725.tmp", gFileContent, function(aStatus, aFile) {
> + ok(Components.isSuccessCode(aStatus),
> + "The temporary file was saved successfully");
> +
trailing whitespace here as well.
Attachment #703094 -
Flags: review?(fayearthur) → review-
| Assignee | ||
Comment 5•13 years ago
|
||
Better patch.
Attachment #703094 -
Attachment is obsolete: true
Attachment #704137 -
Flags: review?(fayearthur)
Comment 6•13 years ago
|
||
Comment on attachment 704137 [details] [diff] [review]
Add support for -sp-context mode-line
Review of attachment 704137 [details] [diff] [review]:
-----------------------------------------------------------------
::: browser/devtools/scratchpad/test/browser_scratchpad_bug_644413_modeline.js
@@ +38,5 @@
> +
> + // Test Scratchpad._scanModeLine method.
> + let obj = gScratchpad._scanModeLine();
> + is(size(obj), 0, "Mode-line object has no properties");
> +
more trailing whitespace in this file, just remove before checking in.
::: browser/devtools/scratchpad/test/head.js
@@ -2,4 @@
> /* Any copyright is dedicated to the Public Domain.
> http://creativecommons.org/publicdomain/zero/1.0/ */
>
> -"use strict";
Why'd you get rid of this?
Attachment #704137 -
Flags: review?(fayearthur) → review+
| Assignee | ||
Comment 7•13 years ago
|
||
Added back "use strict" and removed trailing spaces. Carrying over r+.
Attachment #704137 -
Attachment is obsolete: true
Attachment #704148 -
Flags: review+
| Assignee | ||
Comment 8•13 years ago
|
||
Whiteboard: [fixed-in-fx-team]
Comment 9•13 years ago
|
||
What happens if a scratchpad with a browser modeline is loaded, but devtools.chrome.enabled pref is off?
I think it should not respect the modeline in this case.
Comment 10•13 years ago
|
||
That's right, otherwise we are opening a big security hole in our tools.
Comment 11•13 years ago
|
||
See bug 832880.
Comment 12•13 years ago
|
||
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 21
| Reporter | ||
Updated•13 years ago
|
Keywords: dev-doc-needed
Updated•7 years ago
|
Product: Firefox → DevTools
Updated•6 years ago
|
Product: DevTools → DevTools Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•