зеркало из https://github.com/mozilla/pjs.git
Changed our JS observer of status to watch WebBrowserChrome attributes rather than an older Browser:Status one. OverLink is now separated out. nsBrowserInstance no longer is an nsIObserver. It relies on nsXULWindow::nsIWebBrowserChrome implementation poking attributes on WebBrowserChrome element in the main window.
This commit is contained in:
Родитель
8304436808
Коммит
5391f6b27e
|
@ -42,6 +42,8 @@ catch (ex) {
|
|||
var appCore = null;
|
||||
var defaultStatus = bundle.GetStringFromName( "defaultStatus" );
|
||||
var explicitURL = false;
|
||||
var webBrowserChrome = null;
|
||||
var statusTextFld = null;
|
||||
|
||||
|
||||
function UpdateHistory(event)
|
||||
|
@ -960,14 +962,16 @@ function BrowserEditBookmarks()
|
|||
|
||||
var bindCount = 0;
|
||||
function onStatus() {
|
||||
var status = document.getElementById("Browser:Status");
|
||||
if ( status ) {
|
||||
var text = status.getAttribute("value");
|
||||
if(!webBrowserChrome)
|
||||
webBrowserChrome = document.getElementById("WebBrowserChrome");
|
||||
if ( webBrowserChrome ) {
|
||||
var text = webBrowserChrome.getAttribute("status");
|
||||
if ( text == "" ) {
|
||||
//dump( "Setting default status text\n" );
|
||||
text = defaultStatus;
|
||||
}
|
||||
var statusText = document.getElementById("statusText");
|
||||
if(!statusTextFld)
|
||||
statusText = document.getElementById("statusText");
|
||||
if ( statusText ) {
|
||||
//dump( "Setting status text: " + text + "\n" );
|
||||
statusText.setAttribute( "value", text );
|
||||
|
@ -979,6 +983,25 @@ function BrowserEditBookmarks()
|
|||
}
|
||||
}
|
||||
|
||||
function onOverLink() {
|
||||
if(!webBrowserChrome)
|
||||
webBrowserChrome = document.getElementById("WebBrowserChrome");
|
||||
|
||||
var text = webBrowserChrome.getAttribute("overLink");
|
||||
|
||||
if(text == "")
|
||||
text = defaultStatus;
|
||||
|
||||
if(!statusTextFld)
|
||||
statusTextFld = document.getElementById("statusText");
|
||||
|
||||
statusTextFld = statusTextFld.setAttribute("value", text);
|
||||
}
|
||||
|
||||
function onDefaultStatus() {
|
||||
// XXX Probably should do something here
|
||||
}
|
||||
|
||||
function doTests() {
|
||||
}
|
||||
|
||||
|
@ -999,12 +1022,12 @@ function BrowserEditBookmarks()
|
|||
// Update status bar.
|
||||
} else if ( busy == "false" && wasBusy == "true" ) {
|
||||
// Record page loading time.
|
||||
var status = document.getElementById("Browser:Status");
|
||||
if ( status ) {
|
||||
var webBrowserChrome = document.getElementById("WebBrowserChrome");
|
||||
if ( webBrowserChrome ) {
|
||||
var elapsed = ( (new Date()).getTime() - startTime ) / 1000;
|
||||
var msg = bundle.GetStringFromName("nv_done") + " (" + elapsed + " secs)";
|
||||
dump( msg + "\n" );
|
||||
status.setAttribute("value",msg);
|
||||
webBrowserChrome.setAttribute("status",msg);
|
||||
defaultStatus = msg;
|
||||
}
|
||||
// Turn progress meter off.
|
||||
|
|
|
@ -64,11 +64,15 @@ Contributor(s): ______________________________________. -->
|
|||
<broadcaster id="canStop"/>
|
||||
<broadcaster id="canPrint"/>
|
||||
<broadcaster id="Browser:LoadingProgress"/>
|
||||
<broadcaster id="Browser:Status"/>
|
||||
<broadcaster id="WebBrowserChrome"/>
|
||||
<broadcaster id="Browser:Throbber" busy="false"/>
|
||||
<broadcaster id="args" value=""/>
|
||||
</broadcasterset>
|
||||
|
||||
<observes element="WebBrowserChrome" attribute="status" onbroadcast="onStatus()"/>
|
||||
<observes element="WebBrowserChrome" attribute="overLink" onbroadcast="onOverLink()"/>
|
||||
<observes element="WebBrowserChrome" attribute="defaultStatus" onbroadcast="onDefaultStatus()"/>
|
||||
|
||||
<!-- Interim hack to transition from nsIXULWindowCallbacks/ShowWindowWithArgs -->
|
||||
<broadcaster id="dialog.start" ready="false"/>
|
||||
<observes element="dialog.start" attribute="ready" onbroadcast="onLoadWithArgs()"/>
|
||||
|
@ -446,10 +450,7 @@ Contributor(s): ______________________________________. -->
|
|||
</box>
|
||||
<spring style="width: 1em"/>
|
||||
<titledbutton id="statusText" class="status-bar" align="left" flex="100%"
|
||||
value="&statusText.label;" style="min-width: 1px">
|
||||
<observes element="Browser:Status" attribute="value"
|
||||
onbroadcast="onStatus()"/>
|
||||
</titledbutton>
|
||||
value="&statusText.label;" style="min-width: 1px"/>
|
||||
|
||||
<titledbutton class="status-bar" align="left" value="&buildId.label;"/>
|
||||
<titledbutton id="lock-button" class="borderless" align="left"/>
|
||||
|
|
Загрузка…
Ссылка в новой задаче