Bug 911195 - Properly compartment scroll event object. r=bz

--HG--
extra : rebase_source : 512a70ed17889808f0a6add6b4da7403fb3d4947
This commit is contained in:
Dale Harvey 2013-09-13 15:11:42 +01:00
Родитель a5c62c0299
Коммит 86e50bc815
1 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -302,6 +302,10 @@ private:
NS_IMETHODIMP DispatchAsyncScrollEventRunnable::Run()
{
nsCOMPtr<Element> frameElement = mTabParent->GetOwnerElement();
nsIDocument *doc = frameElement->OwnerDoc();
nsCOMPtr<nsIGlobalObject> globalObject = doc->GetScopeObject();
NS_ENSURE_TRUE(globalObject, NS_ERROR_UNEXPECTED);
// Create the event's detail object.
AsyncScrollEventDetailInitializer detail;
detail.mLeft = mContentRect.x;
@ -310,7 +314,12 @@ NS_IMETHODIMP DispatchAsyncScrollEventRunnable::Run()
detail.mHeight = mContentRect.height;
detail.mScrollWidth = mContentRect.width;
detail.mScrollHeight = mContentRect.height;
AutoSafeJSContext cx;
JS::Rooted<JSObject*> globalJSObject(cx, globalObject->GetGlobalJSObject());
NS_ENSURE_TRUE(globalJSObject, NS_ERROR_UNEXPECTED);
JSAutoCompartment ac(cx, globalJSObject);
JS::Rooted<JS::Value> val(cx);
// We can get away with a null global here because