Fixes issue #1161 Test-case-by: Brian Anderson <banderson@mozilla.com> Signed-off-by: Haitao Li <lihaitao@gmail.com>