The appearance by Mr. Giuliani was perhaps his biggest test yet of how his liberal record on gun control and abortion as a New York City mayor would square with a core Republican constituency now that he is running for president. And he confronted his past directly, saying he faced different challenges taming crime in New York City a decade ago, while signaling that he opposes new restrictions on gun ownership.