Closed
Bug 20721
Opened 25 years ago
Closed 25 years ago
Javascript API to add Sidebar panels
Categories
(SeaMonkey :: Sidebar, defect, P1)
SeaMonkey
Sidebar
Tracking
(Not tracked)
VERIFIED
FIXED
M14
People
(Reporter: slamm, Assigned: rginda)
References
Details
(Whiteboard: [PDT+])
Attachments
(7 files)
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
text/plain
|
Details | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
text/html
|
Details | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review |
Third parties should be able to add panels via javascript,
window.sidebar.addPanel("title","http://content_url","http://customize_url")
Reporter | ||
Updated•25 years ago
|
Status: NEW → ASSIGNED
Priority: P3 → P2
Target Milestone: M13
Summary: [FEATURE] JS API to add panels → [FEATURE] Javascript API to add Sidebar panels
Reporter | ||
Updated•25 years ago
|
Target Milestone: M13 → M14
Reporter | ||
Comment 2•25 years ago
|
||
Sweep M13 bugs to M14.
This is part of the Beta 1 requirements so I'm nominating this as a "beta 1"
blocker.
Steve, did Brendan hose us and go off on sabbatical without checking his stuff
into the tree?
Keywords: beta1
Reporter | ||
Comment 5•25 years ago
|
||
We are hosed. Time for plan 'B': ugly hack.
Summary: [FEATURE] Javascript API to add Sidebar panels → [BETA] Javascript API to add Sidebar panels
Reporter | ||
Updated•25 years ago
|
Priority: P2 → P1
Clayton - this is what we talked about this morning. This is a beta1 stopper
approved by the PDT team and we hope that your team can take care of it working
with slamm.
Clayton says that rginda will do the back end work that Brendan was supposed to
do. Reassigning to rginda, then will later re-assign back to slamm when back
end is ready.
Assignee: slamm → rginda
Status: ASSIGNED → NEW
Comment 10•25 years ago
|
||
No so much that Brendan was supposed to do. He was intending to finish this up
even while on sabbatical. He deserves the time off. Rob offered to fill in.
= C =
Assignee | ||
Comment 11•25 years ago
|
||
I havn't seen how brendan planned on solving this, but I'd like to propose that
we broadcast when a new js environment has been created before
nsJSContext::InitContext exits. The browser chrome could observe this, and
modify the DOM of the content window as it sees fit. It would open up even more
neat additions that automatically appear in each page, like IE DOM emulation,
for example, and, in theory is a simple change.
I've tested it with the current Browser:LoadingProgress broadcaster, and have
been able to create new DOM elements with access to XPConnect. The only catch
with the current observers is that the DOM changes dont appear until *after* the
onLoad handler for the page has fired, so the page is restricted to accessing
the new properties from events or timers.
Assignee | ||
Comment 12•25 years ago
|
||
These attachments should illustrate the basic idea.
When loading the sample html page, the console displays:
during load: sidebar is undefined
after load: sidebar is undefined
Document file:///home/rginda/src/moztests/random.html loaded successfully
Document: Done (0.49 secs)
sidebar_onLoadProgressChange: adding dom hook.
after click: sidebar is [object Object]
after click: calling addPanel:
sidebar_addPanel: arguments were (arg 1, arg 2)
sidebar_addPanel: sample XPCOM component is [xpconnect wrapped nsISample]
Assignee | ||
Comment 13•25 years ago
|
||
Assignee | ||
Comment 14•25 years ago
|
||
Updated•25 years ago
|
Summary: [BETA] Javascript API to add Sidebar panels → Javascript API to add Sidebar panels
Assignee | ||
Comment 15•25 years ago
|
||
This idea has some unfortunate limitations, I'll be going with brendan's plan
described in bug 21953. Hope to have code ready for review tomorrow, 2/10.
Assignee | ||
Comment 16•25 years ago
|
||
26725 is getting in the way, although there is a pref based workaround that will
let me keep going for now.
Depends on: 26725
Assignee | ||
Comment 17•25 years ago
|
||
Assignee | ||
Comment 18•25 years ago
|
||
Assignee | ||
Comment 19•25 years ago
|
||
dom changes sent to vidur for review, sidebar to slamm.
These changes represent a hack to Get It Done for beta1. The real solution is
to fix the nsIScriptNameSpaceManager interface to work with IID (and be
scriptable.) Bug 21953 should be used to track the progress of the correct fix.
Bug 26725 currently gets in the way of seeing this work in the tip.
Adding pref("security.checkxpconnect", false); to all.js, and
Applying appropriate comments to nsGlobalWindow.cpp:3239
(To prevent the following line from failing:
if (NS_FAILED(secMan->GetSubjectPrincipal(getter_AddRefs(principal))))
return NS_ERROR_FAILURE;
)
Should get you to the point where the attached test page can add content to your
sidebar.
Assignee | ||
Comment 20•25 years ago
|
||
Comment 21•25 years ago
|
||
Comment 22•25 years ago
|
||
Comment 23•25 years ago
|
||
I just added a patch THAT SHOULD NOT BE CHECKED IN to show failure due to
insufficent principals in jsloader. It gets the codebase principals for JS
components (with url of http://www.mozilla.org/index.html).
This patch will cause rginda's sidebar stuff to fail for me. While my previous
patch with system principals causes it to work for me.
Assignee | ||
Comment 24•25 years ago
|
||
This patch doesn't seem to work on Linux. I'm going to apply the patches from
the ground up on a fresh tree, just to be sure.
647 rv = secman->GetSystemPrincipal(getter_AddRefs(iPrincipals));
648 if(NS_FAILED(rv) || !iPrincipals)
652 rv = iPrincipals->GetJSPrincipals(&jsPrincipals);
653 if(NS_FAILED(rv) || !jsPrincipals)
(gdb) p jsPrincipals
$1 = (JSPrincipals *) 0x8197b3c
(gdb) p *jsPrincipals
$2 = {codebase = 0x0, getPrincipalArray = 0x405f2d70,
globalPrivilegesEnabled = 0x405f2d7c, refcount = 16, destroy = 0x405f2d90}
656 obj = JS_NewObject(mContext, &gGlobalClass, mSuperGlobal, NULL);
<...>
685 if (NS_FAILED(rv))
688 JSScript *script =
JS_CompileFileHandleForPrincipals(mContext, obj,
(const char *)displayPath,
fileHandle, jsPrincipals);
695 if (!script) {
708 if (!JS_ExecuteScript(mContext, obj, script, &retval)) {
JS Component Loader: ERROR (null):0
uncaught exception: Access denied to XPConnect service.
712 obj = nsnull;
Status: NEW → ASSIGNED
Comment 25•25 years ago
|
||
Rob, I think you should drag norris into this. I can't see why this would not be
working. Perhaps he will.
Assignee | ||
Comment 26•25 years ago
|
||
sidebar, dom, and jsloader changes checked in, the attached sidebar testcase
should work (ie, it should add www.mozilla.org to your sidebar), sans isPanel,
which was taken out due to security concerns.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 27•25 years ago
|
||
Removing dependency on 21953. 21953 should be used to track a more 'correct'
solution to the problem.
No longer depends on: 21953
Comment 28•25 years ago
|
||
Verified on mac/linux/windows 2/16 using attached test case. However, your new
panel is not seen in the current browser window (or any other open windows). To
see the new panel, you must open a new window.
Re-opening, because this is not how the customize dialogue works, so I'm
guessing it can be done. Using the customize dialogue, all open windows are
auto-magically updated once you save changes.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 29•25 years ago
|
||
i'm going to mark this fixed, bug 28073 covers the remaining problem
Status: REOPENED → RESOLVED
Closed: 25 years ago → 25 years ago
Resolution: --- → FIXED
Updated•20 years ago
|
Product: Browser → Seamonkey
You need to log in
before you can comment on or make changes to this bug.
Description
•