Fixing bug 19621. State of activation window is controlled based on the activation server's response in a timeout period of 30 sec. r=matt,ben,tao. a=chofmann

This commit is contained in:
racham%netscape.com 2000-03-04 05:56:56 +00:00
parent 024820eef8
commit d2a00531be
10 changed files with 168 additions and 6 deletions

View File

@ -12,3 +12,5 @@ profileSelection.js
profileSelection.xul
confirmMigration.xul
confirmMigration.js
activation.xul
activationFrame.xul

View File

@ -42,6 +42,8 @@ FILES = \
profileSelection.js \
confirmMigration.xul \
confirmMigration.js \
activation.xul \
activationFrame.xul \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,67 @@
<?xml version="1.0"?>
<!-- -*- Mode: SGML; indent-tabs-mode: nil; -*- -->
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is mozilla.org code.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998 Netscape Communications Corporation. All
Rights Reserved.
-->
<?xml-stylesheet href="chrome://profile/skin/" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://profile/locale/activation.dtd">
<window title="&window.title;" xmlns:html="http://www.w3.org/TR/REC-html40"
class="dialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<html:script src="chrome://global/content/strres.js"/>
<html:script>
<![CDATA[
// strings used internally. No need to localize.
var currURLTitle = "Activation : Frame";
var serverSideID = "Hello from Activation to Profiles team";
function CheckURL()
{
var topFrameTitle = frames[0].document.title;
// Check if we have reached the url
if((topFrameTitle == currURLTitle) || (serverSideID != frames[0].serverSideID))
{
// Need to call this to stop the event loop
try
{
var appShell = Components.classes['component://netscape/appshell/appShellService'].getService();
appShell = appShell.QueryInterface( Components.interfaces.nsIAppShellService);
appShell.Quit();
}
catch (ex)
{
window.close();
}
}
}
setTimeout("CheckURL()", 30000);
]]>
</html:script>
<html:iframe src="chrome://profile/content/activationFrame.xul" flex="1"/>
</window>

View File

@ -0,0 +1,57 @@
<?xml version="1.0"?>
<!-- -*- Mode: SGML; indent-tabs-mode: nil; -*- -->
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is mozilla.org code.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998 Netscape Communications Corporation. All
Rights Reserved.
-->
<?xml-stylesheet href="chrome://profile/skin/" type="text/css"?>
<!DOCTYPE window>
<window title="Activation : Frame" xmlns:html="http://www.w3.org/TR/REC-html40"
class="dialog"
onload="LoadURL();"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<html:script>
<![CDATA[
function LoadURL()
{
var pref = null;
var actvURL = null;
try
{
pref = Components.classes['component://netscape/preferences'];
pref = pref.getService();
pref = pref.QueryInterface(Components.interfaces.nsIPref);
}
catch (ex) {
dump("failed to get prefs service!\n");
pref = null;
top.close();
}
actvURL = pref.CopyCharPref("browser.registration.url");
this.location.href = actvURL;
}
]]>
</html:script>
</window>

View File

@ -39,6 +39,8 @@ FILES=\
profileSelection.js \
confirmMigration.xul \
confirmMigration.js \
activation.xul \
activationFrame.xul \
$(NULL)
install::

View File

@ -9,3 +9,4 @@ newProfile1_2.properties
profileSelection.dtd
confirmMigration.dtd
migration.properties
activation.dtd

View File

@ -39,6 +39,7 @@ FILES = \
migration.properties \
profileSelection.dtd \
confirmMigration.dtd \
activation.dtd \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,28 @@
<!-- -*- Mode: SGML; indent-tabs-mode: nil; -*- -->
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is mozilla.org code.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998 Netscape Communications Corporation. All
Rights Reserved.
Contributor(s):
Contributors:
Ben Goodger (28/10/99)
-->
<!ENTITY window.title "Activation">

View File

@ -36,6 +36,7 @@ FILES=\
migration.properties \
profileSelection.dtd \
confirmMigration.dtd \
activation.dtd \
$(NULL)
install::

View File

@ -102,6 +102,10 @@
#define ACTIVATION_EMAIL_SERVER_NAME "browser.registration.mailservername"
#define ACTIVATION_EMAIL_SERVER_TYPE "browser.registration.mailservertype"
#define ACTIVATION_WINDOW_WIDTH 480
#define ACTIVATION_WINDOW_HEIGHT 480
#define ACTIVATION_FRAME_URL "chrome://profile/content/activation.xul"
#define PROFILE_SELECTION_URL "chrome://profile/content/profileSelection.xul"
#define PROFILE_SELECTION_CMD_LINE_ARG "-SelectProfile"
#define PROFILE_MANAGER_URL "chrome://profile/content/profileSelection.xul?manage=true"
@ -1708,8 +1712,6 @@ nsProfile::TriggerActivation(const char *profileName)
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
if (NS_FAILED(rv)) return rv;
char* pregURL = nsnull;
rv = prefs->CopyCharPref(PREG_URL_PREF, &pregURL);
// Check if the javascript is enabled....
PRBool javascriptEnabled = PR_TRUE;
@ -1734,14 +1736,14 @@ nsProfile::TriggerActivation(const char *profileName)
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIURI> registrationURL;
rv = NS_NewURI(getter_AddRefs(registrationURL), pregURL);
rv = NS_NewURI(getter_AddRefs(registrationURL), ACTIVATION_FRAME_URL);
if (NS_FAILED(rv)) return rv;
rv = pregAppShell->CreateTopLevelWindow(nsnull, registrationURL,
PR_TRUE, PR_TRUE, NS_CHROME_ALL_CHROME,
NS_SIZETOCONTENT, // width
NS_SIZETOCONTENT, // height
ACTIVATION_WINDOW_WIDTH, // width
ACTIVATION_WINDOW_HEIGHT, // height
getter_AddRefs(mPregWindow));
if (NS_FAILED(rv)) return rv;
@ -1762,7 +1764,6 @@ nsProfile::TriggerActivation(const char *profileName)
ProcessPRegCookie();
CRTFREEIF(pregURL);
}
CRTFREEIF(isPregInfoSet);