Skip to content

Commit

Permalink
Don't assert in Lock() and Unlock(), just warn.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Humphrey committed Feb 3, 2012
1 parent 1efd9a3 commit 668623d
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions dom/base/nsDOMMozPointerLock.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ nsDOMMozPointerLock::Unlock()


nsCOMPtr<nsINode> node = do_QueryInterface(mPointerLockedElement); nsCOMPtr<nsINode> node = do_QueryInterface(mPointerLockedElement);
if (!node) { if (!node) {
NS_ERROR("Unlock(): unable to get nsINode for locked element."); NS_WARNING("Unlock(): unable to get nsINode for locked element.");
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
} }
DispatchPointerLockLost(node); DispatchPointerLockLost(node);
Expand All @@ -147,33 +147,33 @@ nsDOMMozPointerLock::Unlock()
// Making the pointer reappear // Making the pointer reappear
nsCOMPtr<nsPIDOMWindow> domWindow( do_QueryInterface( mWindow ) ); nsCOMPtr<nsPIDOMWindow> domWindow( do_QueryInterface( mWindow ) );
if (!domWindow) { if (!domWindow) {
NS_ERROR("Unlock(): No DOM found in nsCOMPtr<nsPIDOMWindow>"); NS_WARNING("Unlock(): No DOM found in nsCOMPtr<nsPIDOMWindow>");
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
} }


nsIDocShell *docShell = domWindow->GetDocShell(); nsIDocShell *docShell = domWindow->GetDocShell();
if (!docShell) { if (!docShell) {
NS_ERROR("Unlock(): No DocShell (window already closed?)"); NS_WARNING("Unlock(): No DocShell (window already closed?)");
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
} }


nsRefPtr<nsPresContext> presContext; nsRefPtr<nsPresContext> presContext;
docShell->GetPresContext(getter_AddRefs(presContext)); docShell->GetPresContext(getter_AddRefs(presContext));
if (!presContext) { if (!presContext) {
NS_ERROR("Unlock(): Unable to get presContext in \ NS_WARNING("Unlock(): Unable to get presContext in \
domWindow->GetDocShell()->GetPresContext()"); domWindow->GetDocShell()->GetPresContext()");
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
} }


nsCOMPtr<nsIPresShell> shell = presContext->PresShell(); nsCOMPtr<nsIPresShell> shell = presContext->PresShell();
if (!shell) { if (!shell) {
NS_ERROR("Unlock(): Unable to find presContext->PresShell()"); NS_WARNING("Unlock(): Unable to find presContext->PresShell()");
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
} }


nsCOMPtr<nsIWidget> widget = shell->GetRootFrame()->GetNearestWidget(); nsCOMPtr<nsIWidget> widget = shell->GetRootFrame()->GetNearestWidget();
if (!widget) { if (!widget) {
NS_ERROR("Unlock(): Unable to find widget in \ NS_WARNING("Unlock(): Unable to find widget in \
shell->GetRootFrame()->GetNearestWidget();"); shell->GetRootFrame()->GetNearestWidget();");
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
} }
Expand Down Expand Up @@ -210,7 +210,7 @@ nsDOMMozPointerLock::ShouldLock(nsIDOMElement* aTarget)
nsCOMPtr<nsIDOMDocument> domDoc; nsCOMPtr<nsIDOMDocument> domDoc;
mWindow->GetDocument(getter_AddRefs(domDoc)); mWindow->GetDocument(getter_AddRefs(domDoc));
if (!domDoc) { if (!domDoc) {
NS_ERROR("ShouldLock(): Unable to get document"); NS_WARNING("ShouldLock(): Unable to get document");
return false; return false;
} }


Expand All @@ -237,7 +237,7 @@ nsDOMMozPointerLock::ShouldLock(nsIDOMElement* aTarget)
nsCOMPtr<nsIContent> content = do_QueryInterface(aTarget); nsCOMPtr<nsIContent> content = do_QueryInterface(aTarget);
doc->FlushPendingNotifications(Flush_Layout); doc->FlushPendingNotifications(Flush_Layout);
if (!(content && content->GetPrimaryFrame())) { if (!(content && content->GetPrimaryFrame())) {
NS_ERROR("ShouldLock(): Unable to get frame for element"); NS_WARNING("ShouldLock(): Unable to get frame for element");
return false; return false;
} }


Expand All @@ -253,7 +253,7 @@ nsDOMMozPointerLock::Lock(nsIDOMElement* aTarget,


nsCOMPtr<nsIContent> element = do_QueryInterface(aTarget); nsCOMPtr<nsIContent> element = do_QueryInterface(aTarget);
if (!element) { if (!element) {
NS_ERROR("Lock: Unable to get nsIContent for locked element"); NS_WARNING("Lock: Unable to get nsIContent for locked element");
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }


Expand All @@ -269,40 +269,40 @@ nsDOMMozPointerLock::Lock(nsIDOMElement* aTarget,


nsCOMPtr<nsPIDOMWindow> domWindow = do_QueryInterface(mWindow); nsCOMPtr<nsPIDOMWindow> domWindow = do_QueryInterface(mWindow);
if (!domWindow) { if (!domWindow) {
NS_ERROR("Lock(): No DOM found in nsCOMPtr<nsPIDOMWindow>"); NS_WARNING("Lock(): No DOM found in nsCOMPtr<nsPIDOMWindow>");
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }


nsIDocShell *docShell = domWindow->GetDocShell(); nsIDocShell *docShell = domWindow->GetDocShell();
if (!docShell) { if (!docShell) {
NS_ERROR("Lock(): No DocShell (window already closed?)"); NS_WARNING("Lock(): No DocShell (window already closed?)");
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
} }


nsRefPtr<nsPresContext> presContext; nsRefPtr<nsPresContext> presContext;
docShell->GetPresContext(getter_AddRefs(presContext)); docShell->GetPresContext(getter_AddRefs(presContext));
if (!presContext) { if (!presContext) {
NS_ERROR("Lock(): Unable to get presContext in \ NS_WARNING("Lock(): Unable to get presContext in \
domWindow->GetDocShell()->GetPresContext()"); domWindow->GetDocShell()->GetPresContext()");
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }


nsCOMPtr<nsIPresShell> shell = presContext->PresShell(); nsCOMPtr<nsIPresShell> shell = presContext->PresShell();
if (!shell) { if (!shell) {
NS_ERROR("Lock(): Unable to find presContext->PresShell()"); NS_WARNING("Lock(): Unable to find presContext->PresShell()");
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }


nsCOMPtr<nsIWidget> widget = shell->GetRootFrame()->GetNearestWidget(); nsCOMPtr<nsIWidget> widget = shell->GetRootFrame()->GetNearestWidget();
if (!widget) { if (!widget) {
NS_ERROR("Lock(): Unable to find widget in \ NS_WARNING("Lock(): Unable to find widget in \
shell->GetRootFrame()->GetNearestWidget();"); shell->GetRootFrame()->GetNearestWidget();");
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }


nsCOMPtr<nsINode> node = do_QueryInterface(element); nsCOMPtr<nsINode> node = do_QueryInterface(element);
if (!node) { if (!node) {
NS_ERROR("Lock(): unable to get nsINode for locked element."); NS_WARNING("Lock(): unable to get nsINode for locked element.");
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
} }
node->AddMutationObserver(this); node->AddMutationObserver(this);
Expand Down

0 comments on commit 668623d

Please sign in to comment.