зеркало из https://github.com/mozilla/gecko-dev.git
fix editPage to use "win" for var instead of "window", look for emptyWindows and use it if possible (bug 104908, r=cmanske, sr=kin, a=dbaron)
This commit is contained in:
Родитель
423e9e246b
Коммит
d4045452e6
|
@ -122,22 +122,42 @@ function editPage(url, launchWindow, delay)
|
||||||
var windowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
|
var windowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
|
||||||
var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);
|
var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);
|
||||||
var enumerator = windowManagerInterface.getEnumerator( "composer:html" );
|
var enumerator = windowManagerInterface.getEnumerator( "composer:html" );
|
||||||
|
var emptyWindow;
|
||||||
while ( enumerator.hasMoreElements() )
|
while ( enumerator.hasMoreElements() )
|
||||||
{
|
{
|
||||||
var window = windowManagerInterface.convertISupportsToDOMWindow( enumerator.getNext() );
|
var win = windowManagerInterface.convertISupportsToDOMWindow( enumerator.getNext() );
|
||||||
if ( window && window.editorShell)
|
if ( win && win.editorShell)
|
||||||
{
|
{
|
||||||
if (window.editorShell.checkOpenWindowForURLMatch(url, window))
|
if (win.editorShell.checkOpenWindowForURLMatch(url, window))
|
||||||
{
|
{
|
||||||
// We found an editor with our url
|
// We found an editor with our url
|
||||||
window.focus();
|
win.focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (!emptyWindow && win.PageIsEmptyAndUntouched())
|
||||||
|
{
|
||||||
|
emptyWindow = win;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (emptyWindow)
|
||||||
|
{
|
||||||
|
// we have an empty window we can use
|
||||||
|
if (emptyWindow.IsInHTMLSourceMode())
|
||||||
|
emptyWindow.FinishHTMLSource();
|
||||||
|
emptyWindow.editorShell.LoadUrl(url);
|
||||||
|
emptyWindow.focus();
|
||||||
|
emptyWindow.SetSaveAndPublishUI(url);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Create new Composer window
|
// Create new Composer window
|
||||||
if (delay)
|
if (delay)
|
||||||
launchWindow.delayedOpenWindow("chrome://editor/content", "chrome,all,dialog=no", url, charsetArg);
|
{
|
||||||
|
dump("delaying\n");
|
||||||
|
launchWindow.delayedOpenWindow("chrome://editor/content", "chrome,all,dialog=no", url);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
launchWindow.openDialog("chrome://editor/content", "_blank", "chrome,all,dialog=no", url, charsetArg);
|
launchWindow.openDialog("chrome://editor/content", "_blank", "chrome,all,dialog=no", url, charsetArg);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче