This is a partial fix for bug 251710 CCBUG: 251710 MERGE: 4.8, 4.9 (cherry picked from commit 2dac6e94)