Bug 949495 - Rework context handling. r=mfinkle