Incorrect/Outdated Basic Command Template for Scratchpad - Firefox Developer Tools | MDN

RESOLVED FIXED

Status

RESOLVED FIXED
4 years ago
2 years ago

People

(Reporter: anaran, Assigned: wbamberg)

Tracking

Details

(URL)

(Reporter)

Description

4 years ago
See:

https://developer.mozilla.org/en-US/docs/Tools/GCLI/Scratchpad

Details:

Components.utils.import("resource:///modules/devtools/gcli.jsm"); gcli.addCommand({
...
});

is outdated and no longer works in current nightly firefox as of this report.

The above would have to change to

Components.utils.import('resource://gre/modules/devtools/gcli.jsm');
gcli.addItems([{
...
}]);

which I verified to work today.
Assignee: eshepherd → wbamberg
Component: General → Developer Tools
OS: Windows XP → All
Hardware: x86 → All
(Assignee)

Updated

3 years ago
Flags: needinfo?(jwalker)
(Assignee)

Comment 1

3 years ago
Joe, the code suggested here:

    Components.utils.import('resource://gre/modules/devtools/gcli.jsm');

doesn't work for me:

> Exception: [Exception... "Component returned failure code: 0x80520012 (NS_ERROR_FILE_NOT_FOUND) [nsIXPCComponents_Utils.import]"  nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)"  location: "JS frame :: Scratchpad/4 :: <TOP_LEVEL> :: line 10"  data: no]

Do you know what I should use to load gcli.jsm?
(Reporter)

Comment 2

3 years ago
Scratchpad Environment Browser ?
(Assignee)

Comment 3

3 years ago
(In reply to Adrian Aichner [:anaran] from comment #2)
> Scratchpad Environment Browser ?

Do you mean, did I check that I set the environment to "Browser"? If so, then yes. If you don't do that you get "Components.utils is undefined".
(Reporter)

Comment 4

3 years ago
I'm getting the same error as you in browser environment. I missed the error at first, using Run in Scratchpad instead of Display.
I've updated the page with a note that this isn't working currently. The bug to fix this properly is bug 1160851.
Flags: needinfo?(jwalker)
(Assignee)

Comment 6

2 years ago
Thanks Joe!
Status: UNCONFIRMED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.