Backout bug 677092 due to bug 818468. a=bajaj
Bug 829921 - Make sure that we don't choose a reference frame that is an ancestor of the root reference frame. r=roc a=bajaj