B2G/gecko/toolkit/components/viewsource/test/browser/browser_viewsourceprefs.js
// Open a new view-source window to check prefs are obeyed.
Open a new view-source window to check prefs are obeyed.
Open a new view - source window to check prefs are obeyed .
function test5() {
  SpecialPowers.setIntPref("view_source.tab_size", 2);
  SpecialPowers.setBoolPref("view_source.wrap_long_lines", true);
  SpecialPowers.setBoolPref("view_source.syntax_highlight", false);
  executeSoon(function() {
    openViewSourceWindow(source, function(aWindow) {
      wrapMenuItem = aWindow.document.getElementById('menu_wrapLongLines');
      syntaxMenuItem = aWindow.document.getElementById('menu_highlightSyntax');
      if (wrapMenuItem.getAttribute("checked") == "false")
        wrapMenuItem.removeAttribute("checked");
      if (syntaxMenuItem.getAttribute("checked") == "false")
        syntaxMenuItem.removeAttribute("checked");
      is(wrapMenuItem.hasAttribute("checked"), true, "Wrap menu item checked");
      is(syntaxMenuItem.hasAttribute("checked"), false, "Syntax menu item unchecked");
      checkStyle(aWindow, "-moz-tab-size", 2);
      checkStyle(aWindow, "white-space", "pre-wrap");
      checkHighlight(aWindow, false);
      closeViewSourceWindow(aWindow, finish);
    });
  });
}
function test5 ( ) { SpecialPowers . setIntPref ( "view_source.tab_size" , 2 ) ; SpecialPowers . setBoolPref ( "view_source.wrap_long_lines" , true ) ; SpecialPowers . setBoolPref ( "view_source.syntax_highlight" , false ) ; executeSoon ( function ( ) { openViewSourceWindow ( source , function ( aWindow ) { wrapMenuItem = aWindow . document . getElementById ( 'menu_wrapLongLines' ) ; syntaxMenuItem = aWindow . document . getElementById ( 'menu_highlightSyntax' ) ; if ( wrapMenuItem . getAttribute ( "checked" ) == "false" ) wrapMenuItem . removeAttribute ( "checked" ) ; if ( syntaxMenuItem . getAttribute ( "checked" ) == "false" ) syntaxMenuItem . removeAttribute ( "checked" ) ; is ( wrapMenuItem . hasAttribute ( "checked" ) , true , "Wrap menu item checked" ) ; is ( syntaxMenuItem . hasAttribute ( "checked" ) , false , "Syntax menu item unchecked" ) ; checkStyle ( aWindow , "-moz-tab-size" , 2 ) ; checkStyle ( aWindow , "white-space" , "pre-wrap" ) ; checkHighlight ( aWindow , false ) ; closeViewSourceWindow ( aWindow , finish ) ; } ) ; } ) ; }
Open a new view-source window to check prefs are obeyed.
Open a new view - source window to check prefs are obeyed .
// Strip checked="false" attributes, since we're not interested in them.