зеркало из https://github.com/mozilla/pjs.git
Bug 412878. Crashes when doc load finished. Possibly specific to framed pages. r=surkov, a=schrep.
This commit is contained in:
Родитель
d985f56661
Коммит
66b4c351aa
|
@ -180,25 +180,37 @@ NS_IMETHODIMP nsAccessibilityService::OnStateChange(nsIWebProgress *aWebProgress
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||||
domWindow->GetDocument(getter_AddRefs(domDoc));
|
domWindow->GetDocument(getter_AddRefs(domDoc));
|
||||||
nsCOMPtr<nsIDOMNode> domDocRootNode(do_QueryInterface(domDoc));
|
nsCOMPtr<nsIDOMNode> domDocNode(do_QueryInterface(domDoc));
|
||||||
NS_ENSURE_TRUE(domDocRootNode, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(domDocNode, NS_ERROR_FAILURE);
|
||||||
|
nsCOMPtr<nsIAccessibleDocument> docAccessible;
|
||||||
// Get the accessible for the new document.
|
|
||||||
// If it not created yet this will create it & cache it, as well as
|
|
||||||
// set up event listeners so that MSAA/ATK toolkit and internal
|
|
||||||
// accessibility events will get fired.
|
|
||||||
nsCOMPtr<nsIAccessible> accessible;
|
|
||||||
GetAccessibleFor(domDocRootNode, getter_AddRefs(accessible));
|
|
||||||
nsCOMPtr<nsPIAccessibleDocument> docAccessible =
|
|
||||||
do_QueryInterface(accessible);
|
|
||||||
NS_ENSURE_TRUE(docAccessible, NS_ERROR_FAILURE);
|
|
||||||
|
|
||||||
PRUint32 eventType = 0;
|
PRUint32 eventType = 0;
|
||||||
if ((aStateFlags & STATE_STOP) && NS_SUCCEEDED(aStatus)) {
|
if (aStateFlags & STATE_STOP) {
|
||||||
eventType = nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE;
|
// Do not create accessible for page load end events
|
||||||
} else if ((aStateFlags & STATE_STOP) && (aStatus & NS_BINDING_ABORTED)) {
|
// in case it was already shut down before page finished loading
|
||||||
eventType = nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_STOPPED;
|
docAccessible = nsAccessNode::GetDocAccessibleFor(domDocNode); // Cached doc accessibles only
|
||||||
} else if (aStateFlags & STATE_START) {
|
if (!docAccessible)
|
||||||
|
return NS_OK;
|
||||||
|
nsCOMPtr<nsIDOMDocument> domDocTest;
|
||||||
|
docAccessible->GetDocument(getter_AddRefs(domDocTest));
|
||||||
|
if (domDocTest != domDoc) {
|
||||||
|
// Doc from accessible is not the doc we started from
|
||||||
|
// We must be shutdown, and domDocTest should be null
|
||||||
|
NS_ASSERTION(!domDocTest, "Doc not shut down but reports incorrect DOM document");
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
eventType = NS_FAILED(aStatus) ? nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_STOPPED :
|
||||||
|
nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Get the accessible for the new document.
|
||||||
|
// If it not created yet this will create it & cache it, as well as
|
||||||
|
// set up event listeners so that MSAA/ATK toolkit and internal
|
||||||
|
// accessibility events will get fired.
|
||||||
|
nsCOMPtr<nsIAccessible> accessible;
|
||||||
|
GetAccessibleFor(domDocNode, getter_AddRefs(accessible)); // Create if necessary
|
||||||
|
docAccessible = do_QueryInterface(accessible);
|
||||||
eventType = nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_START;
|
eventType = nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_START;
|
||||||
nsCOMPtr<nsIWebNavigation> webNav(do_GetInterface(domWindow));
|
nsCOMPtr<nsIWebNavigation> webNav(do_GetInterface(domWindow));
|
||||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(webNav));
|
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(webNav));
|
||||||
|
@ -213,11 +225,9 @@ NS_IMETHODIMP nsAccessibilityService::OnStateChange(nsIWebProgress *aWebProgress
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eventType == 0)
|
nsCOMPtr<nsPIAccessibleDocument> privDocAccessible = do_QueryInterface(docAccessible);
|
||||||
return NS_OK; //no actural event need to be fired
|
if (eventType && privDocAccessible) {
|
||||||
|
privDocAccessible->FireDocLoadEvents(eventType);
|
||||||
if (docAccessible) {
|
|
||||||
docAccessible->FireDocLoadEvents(eventType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -393,11 +393,8 @@ void nsRootAccessible::TryFireEarlyLoadEvent(nsIDOMNode *aDocNode)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// At minimum, create doc accessible so that events are listened to,
|
// The doc accessible should already be created as a result of the
|
||||||
// allowing us to see any mutations from a page load handler
|
// OnStateChange() for the initiation of page loading
|
||||||
nsCOMPtr<nsIAccessible> docAccessible;
|
|
||||||
GetAccService()->GetAccessibleFor(aDocNode, getter_AddRefs(docAccessible));
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDocShellTreeNode> treeNode(do_QueryInterface(treeItem));
|
nsCOMPtr<nsIDocShellTreeNode> treeNode(do_QueryInterface(treeItem));
|
||||||
if (treeNode) {
|
if (treeNode) {
|
||||||
PRInt32 subDocuments;
|
PRInt32 subDocuments;
|
||||||
|
@ -420,8 +417,10 @@ void nsRootAccessible::TryFireEarlyLoadEvent(nsIDOMNode *aDocNode)
|
||||||
if (!rootContentAccessible) {
|
if (!rootContentAccessible) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PRUint32 state = State(rootContentAccessible);
|
PRUint32 state, extState;
|
||||||
if (state & nsIAccessibleStates::STATE_BUSY) {
|
rootContentAccessible->GetFinalState(&state, &extState);
|
||||||
|
if ((state & nsIAccessibleStates::STATE_BUSY) ||
|
||||||
|
(extState & nsIAccessibleStates::EXT_STATE_DEFUNCT)) {
|
||||||
// Don't fire page load events on subdocuments for initial page load of entire page
|
// Don't fire page load events on subdocuments for initial page load of entire page
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче