WebPositive: dont restore session if a ref is received

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Fixes #12850
This commit is contained in:
Paradoxon 2016-07-09 16:07:26 +02:00 committed by Adrien Destugues
parent ac30c58648
commit 8ba07614a4

View File

@ -231,29 +231,32 @@ BrowserApp::ReadyToRun()
fLaunchRefsMessage = NULL;
}
BMessage archivedWindow;
for (int i = 0; fSession->FindMessage("window", i, &archivedWindow) == B_OK;
i++) {
// If no refs led to a new open page, restore previous session.
if (pagesCreated == 0) {
BMessage archivedWindow;
for (int i = 0; fSession->FindMessage("window", i, &archivedWindow) == B_OK;
i++) {
BRect frame = archivedWindow.FindRect("window frame");
BString url;
archivedWindow.FindString("tab", 0, &url);
BrowserWindow* window = new(std::nothrow) BrowserWindow(frame,
fSettings, url, fContext);
BRect frame = archivedWindow.FindRect("window frame");
BString url;
archivedWindow.FindString("tab", 0, &url);
BrowserWindow* window = new(std::nothrow) BrowserWindow(frame,
fSettings, url, fContext);
if (window != NULL) {
window->Show();
pagesCreated++;
for (int j = 1; archivedWindow.FindString("tab", j, &url) == B_OK;
j++) {
printf("Create %d:%d\n", i, j);
_CreateNewTab(window, url, false);
if (window != NULL) {
window->Show();
pagesCreated++;
for (int j = 1; archivedWindow.FindString("tab", j, &url) == B_OK;
j++) {
printf("Create %d:%d\n", i, j);
_CreateNewTab(window, url, false);
pagesCreated++;
}
}
}
}
// If previous session did not contain any window, create a new empty one.
if (pagesCreated == 0)
_CreateNewWindow("", fullscreen);