Place oil in a small saucepan over medium heat. When hot, add onions and mustard seeds and cook, stirring occasionally, until onions are translucent and beginning to brown, about 20 minutes.
Add sugar, vinegars, and salt. Bring to a boil, then reduce to a simmer until thickened, about 45 minutes.
Pack in a clean jar and refrigerate.