Closed
Bug 683511
Opened 13 years ago
Closed 12 years ago
GCLI needs a 'cookie' command
Categories
(DevTools :: Console, defect, P2)
DevTools
Console
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 16
People
(Reporter: jwalker, Assigned: synodinos)
References
Details
(Whiteboard: [gclicommands][good first bug])
Attachments
(1 file, 4 obsolete files)
20.09 KB,
patch
|
dcamp
:
review+
|
Details | Diff | Splinter Review |
This command allows the user to view, add and remove cookies for a given domain
Reporter | ||
Updated•13 years ago
|
Reporter | ||
Updated•13 years ago
|
Whiteboard: [good first bug]
Reporter | ||
Updated•13 years ago
|
OS: Windows 7 → All
Hardware: x86_64 → All
Reporter | ||
Comment 1•13 years ago
|
||
Moving GCLI bugs to Developer Tools: Console. Filter on 'baked beans are off'.
Component: Developer Tools → Developer Tools: Console
Reporter | ||
Updated•13 years ago
|
Reporter | ||
Comment 2•13 years ago
|
||
Bug triage, filter on PEGASUS.
Priority: -- → P2
Target Milestone: --- → Firefox 12
Reporter | ||
Updated•13 years ago
|
Target Milestone: Firefox 12 → Firefox 13
Assignee | ||
Comment 3•13 years ago
|
||
Would a syntax like this be ok?
> cookie set --key fruit --value banana
> cookie get --key fruit
> cookie get fruit
> cookie remove fruit
> cookie remove --key fruit
> cookie set --key fruit --value banana --expires 'Wed Jan 01 2030 00:00:00 GMT+0200 (EET)}' --path '/mydir' --domain 'example.com' --secure true
> cookie set --key fruit --value banana --max-age 2592000 --path '/mydir' --domain 'example.com'
Reporter | ||
Comment 4•13 years ago
|
||
Looks good.
I think we can do without the named parameters when they're mandatory:
> cookie get fruit
> cookie remove fruit
> cookie set fruit banana
> cookie set fruit banana --expires '...' --path '/mydir' --domain 'example.com' --secure true
Makes sense?
Assignee | ||
Comment 5•13 years ago
|
||
Yes, I'll give it a try.
Comment 6•13 years ago
|
||
(In reply to Dionysios G. Synodinos from comment #5)
> Yes, I'll give it a try.
It's yours!
Assignee: nobody → synodinos
Status: NEW → ASSIGNED
Assignee | ||
Comment 7•13 years ago
|
||
Seems to be working for me. Any feedback is welcome, thanks.
Updated•13 years ago
|
Attachment #599368 -
Flags: review?(jwalker)
Reporter | ||
Comment 8•13 years ago
|
||
Comment on attachment 599368 [details] [diff] [review]
Adds support for cookie command(s) in GCLI
Review of attachment 599368 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks Dio. This looks great.
In addition to my query on document below, we also need to work out some tests. I can probably help if you'd like, because I should write some infrastructure to make it easier to write command tests.
::: browser/devtools/webconsole/GcliCommands.jsm
@@ +313,5 @@
> + ],
> + returnType: 'string',
> + exec: function Command_cookieGet(args, context) {
> + let document = context.environment.contentDocument;
> + return unescape(document.defaultView.window.document.cookie.replace(new RegExp("(?:^|.*;\\s*)"
Isn't document.defaultView.window.document the same as 'document'?
Assignee | ||
Comment 9•13 years ago
|
||
(In reply to Joe Walker from comment #8)
> Comment on attachment 599368 [details] [diff] [review]
> Adds support for cookie command(s) in GCLI
>
> Review of attachment 599368 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> Thanks Dio. This looks great.
> In addition to my query on document below, we also need to work out some
> tests. I can probably help if you'd like, because I should write some
> infrastructure to make it easier to write command tests.
Yes, without tests it feels kinda dirty :)
Please add the infrastructure with an example, and I'll add the necessary tests for the 'cookie' command.
> ::: browser/devtools/webconsole/GcliCommands.jsm
> @@ +313,5 @@
> > + ],
> > + returnType: 'string',
> > + exec: function Command_cookieGet(args, context) {
> > + let document = context.environment.contentDocument;
> > + return unescape(document.defaultView.window.document.cookie.replace(new RegExp("(?:^|.*;\\s*)"
>
> Isn't document.defaultView.window.document the same as 'document'?
If I remember correctly no, but I'll double-check and update the patch if necessary. I'm currently experiencing segfault with the current nightly and trying to work around this.
Reporter | ||
Updated•13 years ago
|
Target Milestone: Firefox 13 → Firefox 14
Reporter | ||
Comment 10•13 years ago
|
||
Re: test framework. I'm done, it's in the review queue, so I hope it will land soon.
I've converted all of the existing tests to the new system. As an example (to save digging around in patches), here is Panos' debugger test suite https://gist.github.com/2343085
The actual patch is here: https://bugzilla.mozilla.org/page.cgi?id=splinter.html&bug=720641&attachment=612898
If you click on head.js towards the bottom of the navigation section, you can see the documentation for the test framework.
I've marked this bug depending on the landing of the test framework, so we'll know.
Depends on: 720641
Assignee | ||
Comment 11•13 years ago
|
||
(In reply to Joe Walker from comment #10)
Great, as soon as I can get the nightly to build successfully on my system again (bug 745122), I'll give it a try.
Assignee | ||
Comment 12•13 years ago
|
||
1.) Has testing landed? I don't see any messages when I do make -C obj-x86_64-apple-darwin11.3.0/browser.
2.) Should I be doing something like:
Services.prefs.setBoolPref("devtools.gcli.enable", true)
<Test goes here>
Services.prefs.setBoolPref("devtools.gcli.enable", false);
All feedback is welcomed.
Comment 13•13 years ago
|
||
(In reply to Dio Synodinos from comment #12)
> Created attachment 618417 [details] [diff] [review]
> Adds support for cookie command(s) in GCLI and tests
>
> 1.) Has testing landed? I don't see any messages when I do make -C
> obj-x86_64-apple-darwin11.3.0/browser.
>
> 2.) Should I be doing something like:
>
> Services.prefs.setBoolPref("devtools.gcli.enable", true)
> <Test goes here>
> Services.prefs.setBoolPref("devtools.gcli.enable", false);
>
> All feedback is welcomed.
It landed a few hours ago in fx-team and those things are taken care of for you automatically. You only need to add the test in Makefile.in, in the _BROWSER_TEST_FILES section. Then you rebuild and run it with:
TEST_PATH=browser/devtools/shared/test/browser_gcli_cookie.js make -C obj-ff-dbg mochitest-browser-chrome
Assignee | ||
Comment 15•13 years ago
|
||
Reporter | ||
Comment 16•13 years ago
|
||
Update at last!
Here's what I changed:
- Rebased since gcli got it's own directory
- Added 'cookie' command
- Fixed several tests, only one fails now (see below)
- Made several of the 'cookie set' parameters optional
Here's what I think we must do:
- Localize the missing strings
- Document the regexp in Command_cookieGet
- Fix the test which is related to the regexp in Command_cookieGet
Here's what I'd like to do (and I can help with):
- GCLI needs a date type so we can say '--expires now'
- Add a cookieName type so we get completion for 'cookie get' and
'cookie remove'
- Get the UI updates for parameters in
- Add a 'cookie list' command?
Attachment #599368 -
Attachment is obsolete: true
Attachment #618417 -
Attachment is obsolete: true
Attachment #619710 -
Attachment is obsolete: true
Attachment #599368 -
Flags: review?(jwalker)
Assignee | ||
Comment 17•13 years ago
|
||
(In reply to Joe Walker from comment #16)
> Created attachment 628305 [details] [diff] [review]
> Upload 4
>
> Update at last!
>
> Here's what I changed:
> - Rebased since gcli got it's own directory
> - Added 'cookie' command
> - Fixed several tests, only one fails now (see below)
> - Made several of the 'cookie set' parameters optional
>
> Here's what I think we must do:
> - Localize the missing strings
> - Document the regexp in Command_cookieGet
> - Fix the test which is related to the regexp in Command_cookieGet
>
> Here's what I'd like to do (and I can help with):
> - GCLI needs a date type so we can say '--expires now'
> - Add a cookieName type so we get completion for 'cookie get' and
> 'cookie remove'
> - Get the UI updates for parameters in
> - Add a 'cookie list' command?
Would love to help on those. Is it ok to go over them in person in NYC or are there any milestones before that?
Reporter | ||
Comment 18•13 years ago
|
||
(In reply to Dio Synodinos from comment #17)
> Would love to help on those. Is it ok to go over them in person in NYC or
> are there any milestones before that?
I'm happy to hack on it in NYC. The first 3 items are things you could take a look at easily if you had time.
Thanks
Reporter | ||
Comment 19•13 years ago
|
||
Some work on a DateType:
https://github.com/joewalker/gcli/commits/cookie-683511
Reporter | ||
Updated•13 years ago
|
Target Milestone: Firefox 15 → Firefox 16
Comment 20•12 years ago
|
||
Filter on teabags
Whiteboard: [good first bug] → [gclicommands][good first bug]
Reporter | ||
Comment 21•12 years ago
|
||
Attachment #628305 -
Attachment is obsolete: true
Attachment #639684 -
Flags: review?(fayearthur)
Comment 22•12 years ago
|
||
Comment on attachment 639684 [details] [diff] [review]
Upload 5
Changing review to dcamp, as he knows about cookies.
Attachment #639684 -
Flags: review?(fayearthur) → review?(dcamp)
Comment 23•12 years ago
|
||
Comment on attachment 639684 [details] [diff] [review]
Upload 5
Review of attachment 639684 [details] [diff] [review]:
-----------------------------------------------------------------
::: browser/devtools/commandline/GcliCommands.jsm
@@ -237,5 @@
> let ctx = canvas.getContext("2d");
> ctx.drawWindow(window, left, top, width, height, "#fff");
>
> let data = canvas.toDataURL("image/png", "");
> - let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
Why all the Cc->Components.classes?
Reporter | ||
Comment 24•12 years ago
|
||
(In reply to Dave Camp (:dcamp) from comment #23)
> Comment on attachment 639684 [details] [diff] [review]
> Upload 5
>
> Review of attachment 639684 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: browser/devtools/commandline/GcliCommands.jsm
> @@ -237,5 @@
> > let ctx = canvas.getContext("2d");
> > ctx.drawWindow(window, left, top, width, height, "#fff");
> >
> > let data = canvas.toDataURL("image/png", "");
> > - let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
>
> Why all the Cc->Components.classes?
No good reason. Will remove.
Comment 25•12 years ago
|
||
Comment on attachment 639684 [details] [diff] [review]
Upload 5
r+ without the Cc->Components.classes changes.
Attachment #639684 -
Flags: review?(dcamp) → review+
Comment 26•12 years ago
|
||
Added to master patch in bug 768998
Comment 27•12 years ago
|
||
Copy / paste error ... added to master patch in but 771555.
Reporter | ||
Updated•12 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•