Bug 910978 part.1 Implement nsScriptErrorEvent::AssignScriptErrorEventData() r=smaug

This commit is contained in:
Masayuki Nakano 2013-09-03 20:45:28 +09:00
parent dbd118e0fe
commit d0e6aba193
3 changed files with 26 additions and 2 deletions

View File

@ -587,8 +587,7 @@ nsDOMEvent::DuplicatePrivateData()
nsScriptErrorEvent* oldScriptErrorEvent =
static_cast<nsScriptErrorEvent*>(mEvent);
nsScriptErrorEvent* scriptErrorEvent = new nsScriptErrorEvent(false, msg);
scriptErrorEvent->AssignEventData(*oldScriptErrorEvent, true);
scriptErrorEvent->lineNr = oldScriptErrorEvent->lineNr;
scriptErrorEvent->AssignScriptErrorEventData(*oldScriptErrorEvent, true);
newEvent = scriptErrorEvent;
break;
}

View File

@ -768,6 +768,20 @@ public:
int32_t lineNr;
const PRUnichar* errorMsg;
const PRUnichar* fileName;
// XXX Not tested by test_assign_event_data.html
void AssignScriptErrorEventData(const nsScriptErrorEvent& aEvent,
bool aCopyTargets)
{
AssignEventData(aEvent, aCopyTargets);
lineNr = aEvent.lineNr;
// We don't copy errorMsg and fileName. If it's necessary, perhaps, this
// should duplicate the characters and free them at destructing.
errorMsg = nullptr;
fileName = nullptr;
}
};
/**

View File

@ -49,6 +49,17 @@ const NATIVE_CONTROL_RIGHT = 0x0800;
const NATIVE_META_RIGHT = 0x8000;
const kTests = [
{ description: "nsScriptErrorEvent",
targetID: "input-text", eventType: "error",
dispatchEvent: function () {
return;
},
canRun: function () {
todo(false, "nsScriptErrorEvent isn't tested");
return false;
},
todoMismatch: [],
},
{ description: "nsKeyEvent (keydown of 'a' key without modifiers)",
targetID: "input-text", eventType: "keydown",
dispatchEvent: function () {